Skip to content
Source
Sign inSign up
TanStack/db

fix(db): includes orderBy ignored after optimistic update on child collection #1496

Closedcomet08(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/1496/headopened

Showing 3 changed files with 93 additions and 0 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/twelve-jars-lead.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/db': patch
+---
+​
+fix: preserve orderBy in includes after child collection update
6 additions and 0 deletionspackages/db/src/query/live/collection-config-builder.tsModified
View file
@@ -896,6 +896,9 @@
} else if (multiplicity > 0) {
existing.inserts += multiplicity
existing.value = childResult
+ if (_orderByIndex !== undefined) {
+ existing.orderByIndex = _orderByIndex
+ }
​
byChild.set(childKey, existing)
@@ -1290,6 +1293,9 @@
} else if (multiplicity > 0) {
existing.inserts += multiplicity
existing.value = childResult
+ if (_orderByIndex !== undefined) {