From a933f96d1cf4bd1bc82645f18e1c9410e050ad76 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:50:04 -0600 Subject: [PATCH 1/7] fix(BTableLite): Use primary key to persist row-details state when items change (#2871) --- apps/docs/src/docs/components/table.md | 4 + .../src/components/BTable/BTableLite.vue | 87 ++++++++- .../src/components/BTable/table-lite.spec.ts | 184 ++++++++++++++++++ 3 files changed, 265 insertions(+), 10 deletions(-) diff --git a/apps/docs/src/docs/components/table.md b/apps/docs/src/docs/components/table.md index 9f2771e6c..8a25df152 100644 --- a/apps/docs/src/docs/components/table.md +++ b/apps/docs/src/docs/components/table.md @@ -592,6 +592,10 @@ for proper reactive detection of changes to its value. Read more about [how reactivity works in Vue](https://vuejs.org/guide/extras/reactivity-in-depth.html#Change-Detection-Caveats). ::: +::: info NOTE +When using the `primary-key` prop, row details will persist even when items are replaced with new object references, as long as the primary key value remains the same. This allows row details to stay open in scenarios like "Load more" or pagination. Without a `primary-key`, the component uses a `WeakMap` for memory efficiency, and row details will close when items are garbage collected or replaced with new object references. +::: + **Available `row-details` scoped variable properties:** | Property | Type | Description | diff --git a/packages/bootstrap-vue-next/src/components/BTable/BTableLite.vue b/packages/bootstrap-vue-next/src/components/BTable/BTableLite.vue index 70edbaf8a..782eb987f 100644 --- a/packages/bootstrap-vue-next/src/components/BTable/BTableLite.vue +++ b/packages/bootstrap-vue-next/src/components/BTable/BTableLite.vue @@ -120,7 +120,7 @@ :field="field" :items="items" :toggle-details="() => toggleRowDetails(item)" - :details-showing="isTableItem(item) ? (detailsMap.get(item) ?? false) : false" + :details-showing="isTableItem(item) ? (getDetailsValue(item) ?? false) : false" >