-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat(docs): add prefetching example from tanstack-query examples #40
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Looks like the default query function have some side effects. 🤔 The example implemented in this PR is only working properly, when I remove the |
@michaelxvoelker sounds weird 🤔. Can you please add a debugger inside the default query function and see if it's stopped there? |
I found the culprit. The provided return <QueryClientConfig>{
defaultOptions: {
queries: {
queryFn,
},
},
}; will overwrite the default configuration of export const QueryClient = new InjectionToken<QueryCore>('QueryClient', {
providedIn: 'root',
factory() {
const options = inject(QUERY_CLIENT_OPTIONS);
return new QueryCore({
defaultOptions: {
queries: {
staleTime: Infinity,
...options?.defaultOptions?.queries,
},
},
...options,
});
},
}); Is this intentional? 🤔 Looks like |
Yes, it's a bug. |
I can provide a fix within this PR. |
Go ahead |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #34
What is the new behavior?
Does this PR introduce a breaking change?
Other information