From 962202ccd652ebe6b58a249b5e92c724b017dc9d Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Mon, 18 Apr 2022 19:17:30 +0200 Subject: [PATCH] Use store $ assignment to fix batch selection Without the `=` sign, the reactivity chain were broken. Using an assignment by prefixing the store with a `$` fixes this. https://svelte.dev/docs#component-format-script-4-prefix-stores-with-$-to-access-their-values --- src/DataTable/DataTable.svelte | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/DataTable/DataTable.svelte b/src/DataTable/DataTable.svelte index 91509ceb..e0a8dbf2 100644 --- a/src/DataTable/DataTable.svelte +++ b/src/DataTable/DataTable.svelte @@ -195,16 +195,14 @@ $: if (radio || batchSelection) selectable = true; $: tableSortable.set(sortable); $: headerKeys = headers.map(({ key }) => key); - $: tableRows.set( - rows.map((row) => ({ - ...row, - cells: headerKeys.map((key, index) => ({ - key, - value: resolvePath(row, key), - display: headers[index].display, - })), - })) - ); + $: $tableRows = rows.map((row) => ({ + ...row, + cells: headerKeys.map((key, index) => ({ + key, + value: resolvePath(row, key), + display: headers[index].display, + })), + })); $: sortedRows = [...$tableRows]; $: ascending = $sortHeader.sortDirection === "ascending"; $: sortKey = $sortHeader.key;