Skip to content
Source
Sign inSign up
TanStack/db

fix(solid-db): preserve live result identity during reconciliation #1825

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/1825/headmerged by tannerlinsley

Showing 3 changed files with 46 additions and 4 deletions (loading 1).

x
0 of 3 viewed, 3 left
6 additions and 0 deletions.changeset/fix-solid-custom-key-reconciliation.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/solid-db': patch
+---
+​
+Keep Solid live-query rows tied to their result identities when custom-key rows
+reorder or multiple results share the same public `$key`.
40 additions and 4 deletionspackages/solid-db/src/useLiveQuery.tsModified
View file
@@ -329,7 +329,14 @@
// Reactive state that gets updated granularly through change events
const state = new ReactiveMap<string | number, any>()
​
- // Reactive data array that maintains sorted order
+ // Keep the live Collection's result keys private while preserving one stable
+ // Solid store per logical row. A row's public $key can belong to an upstream
+ // Collection and is therefore not necessarily unique in this result.
+ const rowsByKey = new Map<
+ string | number,
+ { value: any; update: (value: any) => void }
Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)