Skip to content
Source
Sign inSign up
TanStack/db

fix(solid-db): set key option to $key when calling reconcile #1598

ClosedLeonabcd123(GitHub profile, opens in a new tab)wants to merge 9 commits intomain fromrefs/pull/1598/headopened

Showing 3 changed files with 62 additions and 1 deletion.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/solid-id-rendering.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/solid-db': patch
+---
+​
+Fix reconcile usage in useLiveQuery by setting the key field to "$key" so that items are matched correctly during reconciliation. Fixes #1524.
3 additions and 1 deletionpackages/solid-db/src/useLiveQuery.tsModified
View file
@@ -346,7 +346,9 @@
currentCollection: Collection<any, any, any>,
) => {
setData((prev) =>
- reconcile(Array.from(currentCollection.values()))(prev).filter(Boolean),
+ reconcile(Array.from(currentCollection.values()), { key: '$key' })(
+ prev,
+ ).filter(Boolean),
​
54 additions and 0 deletionspackages/solid-db/tests/useLiveQuery.test.tsxModified
View file