-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expose queryHash on QueryFunctionContext
#9812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* Initial plan * Add queryHash to QueryFunctionContext implementation and update tests Co-authored-by: ElliotChong-MS <[email protected]> * Add queryHash to QueryFunctionContext documentation and test Co-authored-by: ElliotChong-MS <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ElliotChong-MS <[email protected]>
🦋 Changeset detectedLatest commit: 079c7b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughAdds a new public property Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Creator as Query Creator
participant Query as Query Instance
participant Utils as hashQueryKeyByOptions
participant Runner as Query Executor / QueryFn
participant Persister as Persister
Creator->>Utils: compute queryHash(queryKey, options)
Utils-->>Creator: queryHash
Creator->>Query: new Query(..., queryHash)
Query->>Runner: execute(queryFnContext { queryKey, client, meta, signal, queryHash })
Runner-->>Query: result
Note right of Persister: Persister setup uses precomputed\nqueryHash for storageKey
Creator->>Persister: setupPersister(context { queryHash, ... })
Persister-->>Creator: persister ready
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (1)packages/query-core/src/__tests__/query.test.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
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 |
|
what do you need the queryHash for in here? |
|
View your CI Pipeline Execution ↗ for commit 079c7b1
☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9812 +/- ##
===========================================
+ Coverage 45.75% 59.78% +14.02%
===========================================
Files 200 129 -71
Lines 8408 5622 -2786
Branches 1929 1533 -396
===========================================
- Hits 3847 3361 -486
+ Misses 4113 1956 -2157
+ Partials 448 305 -143 🚀 New features to boost your workflow:
|
🎯 Changes
This PR exposes
queryHashonQueryFunctionContextso query functions have first-class access to the canonical identifier of the query without recomputing the hash or performing an expensive lookup in theQueryCache. This is an additive, backward-compatible enhancement.Discussion Item: #9811
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
New Features
Documentation
Tests