From 32679e4d64fcd61d1528df162b0339c4c91f16b8 Mon Sep 17 00:00:00 2001 From: Clay Levering Date: Mon, 20 Apr 2026 19:15:30 -0700 Subject: [PATCH 1/2] fix(Tabs,Accordion): use item value as stable key to avoid remounts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both `UTabs` and `UAccordion` used `:key="index"` when rendering their `v-for` items. When items are added, removed, or reordered, Vue sees "the same key at the same position," reuses the DOM element, and swaps its inner content — which unmounts any stateful descendant of the reused slot. For `UTabs` this means every tab after the changed position loses local state (counters, form inputs, subscriptions). For `UAccordion` the same pattern causes content remounts and occasional hydration oddness when combined with lazy-loaded islands. Switch both to `:key="get(item, valueKey) ?? index"` — the same expression already used for `:value` — so items with a user-provided `value` get a stable identity across reorders, while items without a value keep the previous index-based behaviour. Closes #5841 --- src/runtime/components/Accordion.vue | 2 +- src/runtime/components/Tabs.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/components/Accordion.vue b/src/runtime/components/Accordion.vue index 4d8eee90fb..b9ac2d935b 100644 --- a/src/runtime/components/Accordion.vue +++ b/src/runtime/components/Accordion.vue @@ -106,7 +106,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.accordion ||