@viliha/vui-ui 1.13.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ backward-compatible features, **major** for breaking changes.
7
7
 
8
8
  To upgrade, see [Upgrading](./AGENT.md#upgrading) in the agent guide.
9
9
 
10
+ ## 1.13.1 — 2026-07-26
11
+
12
+ ### Fixed
13
+
14
+ - **Keep-alive tabs now truly preserve a page's live state across tab switches**
15
+ (within `NEXT_PUBLIC_MAX_TABS`). The scaffold's `KeepAliveTabs` was overwriting
16
+ a route's cached element with Next's fresh `children` on every re-activation,
17
+ which remounted the page and threw away its state — so a server-backed table
18
+ (e.g. the Data Table demo) refetched every time you returned to its tab. It now
19
+ caches each route's element once and reuses it, so switching away and back keeps
20
+ the loaded data, scroll, and form state with no reload. Query-param routes
21
+ (`/organizations/edit?id=…`) still update via their own `useSearchParams`.
22
+
10
23
  ## 1.13.0 — 2026-07-26
11
24
 
12
25
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viliha/vui-ui",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Vui UI — a clean, token-driven React admin/CRM component library built on Tailwind CSS v4, shadcn-style patterns, and Radix Icons. Ships as TypeScript source (Just-in-Time), compiled by the consuming app.",
5
5
  "license": "MIT",
6
6
  "author": "Suman Bonakurthi",
@@ -503,11 +503,14 @@ export function KeepAliveTabs({ children }: { children: React.ReactNode }) {
503
503
  const active = tabKey(usePathname());
504
504
  const { tabs } = useOpenTabs();
505
505
  const cache = React.useRef(new Map<string, React.ReactNode>());
506
- // Refresh the active route's element (so re-opening an /edit tab with a
507
- // different record shows the right data); inactive tabs keep their cached
508
- // element and stay mounted. In-progress form work survives via RecordForm's
509
- // sessionStorage draft (see persistKey), which is StrictMode-safe.
510
- cache.current.set(active, children);
506
+ // Cache each route's element ONCE, on first activation, and reuse it — never
507
+ // overwrite on re-activation. Reusing the same element reference is what lets
508
+ // React keep the mounted instance (and its loaded data / scroll / form state)
509
+ // across tab switches; overwriting with Next's fresh `children` would remount
510
+ // the subtree and reload everything. Routes that vary by query param (e.g.
511
+ // /organizations/edit?id=…) share one tab and update themselves via
512
+ // `useSearchParams`, so they don't need a refresh here.
513
+ if (!cache.current.has(active)) cache.current.set(active, children);
511
514
  // Drop entries for tabs that have been closed.
512
515
  const open = new Set(tabs.map((t) => t.href));
513
516
  for (const key of [...cache.current.keys()]) {