fix(solid-query): skip reconcile when data reference is unchanged#10598
fix(solid-query): skip reconcile when data reference is unchanged#10598ousamabenyounes wants to merge 1 commit intoTanStack:mainfrom
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughA patch release for ChangesReconcile deduplication
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 6d1305d
☁️ Nx Cloud last updated this comment at |
Previously, the reconcile path in useBaseQuery would invoke the user's reconcile callback (or the structural reconcile from solid-js/store) multiple times per logical query update — once for fetching=true transitions where the data reference had not changed, and again when the actual data resolved. With user-provided reconcile functions, this showed up as oldData === newData calls. Short-circuit reconcileFn when store.data === result.data; the rest of the result still flows through setState so isFetching/status updates keep working. Closes TanStack#8873
06b14a6 to
6d1305d
Compare
Summary
In
useBaseQuery, the reconcile path could fire multiple times per logical query update — once for fetching state transitions whereresult.datawas the same reference as the current store data, and again when the actual data resolved. With a user-providedreconcilecallback, this surfaced asoldData === newDatainvocations and 2-4 reconcile calls per request.This change short-circuits
reconcileFnwhenstore.data === result.data. The rest of the result still flows throughsetStatesoisFetching/statuskeep updating reactively.Closes #8873
Test plan
useQuery.test.tsx > should not call user-provided reconcile function when result.data reference is unchanged (#8873)pnpm exec nx run @tanstack/solid-query:test:lib— 310 passedpnpm exec nx run @tanstack/solid-query:test:types— passedpnpm exec nx run @tanstack/solid-query:test:eslint— passedGenerated by Ora Studio / Vibe coded by ousamabenyounes
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests
Chores
Generated by Ora Studio (with Claude Code)
Vibe coded by Ben Younes Ousama