🎯 Changes#
Closes #12466
useBaseQueryLayer's onCacheEvent was bumping version() on every QueryCache event matching the active query hash, including observer lifecycle/sync events (observerAdded, observerRemoved, observerOptionsUpdated, and observerResultsUpdated). Those events don't modify QueryState, yet bumping version() forces computeData (select) and metaProjection to recompute — which on Solid 2 can cause a <Show> gated on q.data whose child subscribes to the same query key to loop mounting new observers.
With this change:
- Only state-changing cache events (
added, removed, updated) bump version.
- Because
QueryObserver's stale timer notifies via observerResultsUpdated without mutating QueryState, isStale() tracks a dedicated staleVersion signal (created unconditionally alongside primed to preserve SSR/client hydration ID parity) and bumps it only on observerResultsUpdated when this hook's computed isStale boolean flips.
- Sibling mounts, option changes, stale timer ticks, and unmounts leave
version (and thus select, data, and meta) untouched.
- Added regression coverage in
packages/solid-query/src/__tests__/observer-cache-events.test.tsx (tested locally across @tanstack/solid-query: oxfmt, test:oxlint, compile, test:types across TS 5.7–7.1, build, test:build, vitest run 31/31 files / 408 passed, and test:docs).
✅ Checklist#
🚀 Release Impact#