feat(query-core): include current query as a placeholder data functio…#10427
feat(query-core): include current query as a placeholder data functio…#10427mkljczk wants to merge 1 commit intoTanStack:mainfrom
Conversation
…n param Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
📝 WalkthroughWalkthroughThe changes extend the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/framework/react/reference/useQuery.md (1)
158-162:⚠️ Potential issue | 🟡 MinorDocumentation is incomplete for the new
currentQueryparameter.The signature on line 158 correctly includes
currentQuery: Query, but the description on line 162 only mentions the first two arguments. Consider updating the description to explain the third argument:- If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. + If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, the second argument will be the complete previousQuery instance, and the third argument will be the current query instance.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/framework/react/reference/useQuery.md` around lines 158 - 162, The doc text for the placeholderData function signature is missing a description of the third parameter; update the paragraph describing placeholderData (the entry for placeholderData: TData | (previousValue: TData | undefined, previousQuery: Query | undefined, currentQuery: Query) => TData) to explicitly document the third argument named currentQuery: explain that when a function is provided it receives (1) previous watched query data (or undefined), (2) the previous Query instance (or undefined), and (3) the current Query instance that is about to be observed so callers can inspect its key/options to compute placeholder data accordingly; mention that currentQuery is the live Query object for the pending observation.docs/framework/solid/reference/useQuery.md (1)
207-211:⚠️ Potential issue | 🟡 MinorDocumentation is incomplete for the new
currentQueryparameter.Same issue as the React documentation: the signature includes
currentQuery: Query, but the description only explains the first two arguments. Consider updating:- If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. + If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, the second argument will be the complete previousQuery instance, and the third argument will be the current query instance.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/framework/solid/reference/useQuery.md` around lines 207 - 211, The docs for placeholderData are missing an explanation of the third parameter; update the placeholderData signature description (for placeholderData: TData | (previousValue: TData | undefined, previousQuery: Query | undefined, currentQuery: Query) => TData) to document the currentQuery parameter: explain that when placeholderData is a function it receives (1) the previously watched query data (previousValue), (2) the previous Query instance (previousQuery) and (3) the current Query instance (currentQuery) representing the query that is about to be observed, and clarify how currentQuery can be used to derive placeholder values based on the new query context and that placeholderData is not persisted to the cache; reference the placeholderData signature and the Query type in the description.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@docs/framework/react/reference/useQuery.md`:
- Around line 158-162: The doc text for the placeholderData function signature
is missing a description of the third parameter; update the paragraph describing
placeholderData (the entry for placeholderData: TData | (previousValue: TData |
undefined, previousQuery: Query | undefined, currentQuery: Query) => TData) to
explicitly document the third argument named currentQuery: explain that when a
function is provided it receives (1) previous watched query data (or undefined),
(2) the previous Query instance (or undefined), and (3) the current Query
instance that is about to be observed so callers can inspect its key/options to
compute placeholder data accordingly; mention that currentQuery is the live
Query object for the pending observation.
In `@docs/framework/solid/reference/useQuery.md`:
- Around line 207-211: The docs for placeholderData are missing an explanation
of the third parameter; update the placeholderData signature description (for
placeholderData: TData | (previousValue: TData | undefined, previousQuery: Query
| undefined, currentQuery: Query) => TData) to document the currentQuery
parameter: explain that when placeholderData is a function it receives (1) the
previously watched query data (previousValue), (2) the previous Query instance
(previousQuery) and (3) the current Query instance (currentQuery) representing
the query that is about to be observed, and clarify how currentQuery can be used
to derive placeholder values based on the new query context and that
placeholderData is not persisted to the cache; reference the placeholderData
signature and the Query type in the description.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a6d47998-c6bc-486f-afb3-ba61cc96a1f1
📒 Files selected for processing (6)
.changeset/long-bars-lay.mddocs/framework/react/reference/useQuery.mddocs/framework/solid/reference/useQuery.mdpackages/query-core/src/__tests__/queryObserver.test.tsxpackages/query-core/src/queryObserver.tspackages/query-core/src/types.ts
…n param
🎯 Changes
current query is now provided to placeholder data function. I tried to explain my use case in the test, basically I want to provide a placeholder data function globally, where it previously didn't have access to query key so it was quite useless for me.
✅ Checklist
pnpm run test:pr.🚀 Release Impact