Skip to content
Source
Sign inSign up
TanStack/db

fix(db): canonicalize loadSubset demand identity #1768

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

Showing 16 changed files with 11 additions and 0 deletions (loading 14).

x
0 of 16 viewed, 16 left
6 additions and 0 deletions.changeset/canonical-demand-identity.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/db': patch
+'@tanstack/query-db-collection': patch
+---
+​
+Canonicalize equivalent loadSubset queries to one demand identity while preserving observable output aliases, exact projected values, and distinct ordered windows. Query DB now reuses the same canonical identity for its on-demand cache keys.
5 additions and 0 deletionspackages/db/src/query/index.tsModified
View file
@@ -98,9 +98,13 @@
export {
UnhashableQueryIRError,
canonicalizeQueryIR,
+ getLoadSubsetDemandKey,
+ getQueryIdentity,
getStableQueryBuilderHash,
getStableQueryIRHash,
getStableValueHash,
+ type DemandKey,
+ type QueryIdentity,
} from './ir-stable-identity.js'
​
// Predicate utilities for predicate push-down
@@ -112,6 +116,7 @@