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 into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ 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
Sequence Diagram(s)sequenceDiagram
participant Store
participant ReconcileFn
participant Result
Store->>ReconcileFn: provide store.data
Result->>ReconcileFn: provide result.data
ReconcileFn->>ReconcileFn: compare store.data === result.data
alt equal
ReconcileFn-->>Store: return result (short-circuit)
else not equal
ReconcileFn->>Reconcile: call user reconcile / structural reconcile
Reconcile-->>Store: updated store.data
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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 3cab82c
☁️ Nx Cloud last updated this comment at |
bc661bc to
6f43e91
Compare
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
6f43e91 to
3cab82c
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