compote-ui 0.55.3 → 0.55.4
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.
|
@@ -12,11 +12,18 @@ export function createTable(options) {
|
|
|
12
12
|
...createColumnVisibility(options.columns),
|
|
13
13
|
...options.initialState?.columnVisibility
|
|
14
14
|
};
|
|
15
|
+
// Recompute the resolved column defs only when the source columns change.
|
|
16
|
+
// $derived keeps the reference stable between changes so TanStack's column
|
|
17
|
+
// memoization isn't invalidated on every access. Pass `columns` through a
|
|
18
|
+
// getter (like `data`) to make adding/removing/reordering columns reactive.
|
|
19
|
+
const columnDefs = $derived(createColumns(options.columns, localeCtx));
|
|
15
20
|
const table = createSvelteTable({
|
|
16
21
|
get data() {
|
|
17
22
|
return options.data;
|
|
18
23
|
},
|
|
19
|
-
columns
|
|
24
|
+
get columns() {
|
|
25
|
+
return columnDefs;
|
|
26
|
+
},
|
|
20
27
|
getCoreRowModel: getCoreRowModel(),
|
|
21
28
|
getSortedRowModel: getSortedRowModel(),
|
|
22
29
|
getFilteredRowModel: getFilteredRowModel(),
|