Closed codytooker closed 2 years ago
Thanks! We should definitely add this and add ability to override our default options.
This needs to wait until https://github.com/blitz-js/blitz/pull/2516 is merged.
I think adding the config in blitz.config makes sense, but we'll just have to figure out how to get that code into both server and client environments for runtime.
This is covered by the Blitz Toolkit. Docs: https://alpha.blitzjs.com/docs/rpc-setup
What do you want and why?
The ability to set React Query
QueryClient
default options. Blitz provides some defaults adding to React Queries already aggressive fetching defaults. Being able to configure the rest of default options from React Query would be a great additionPossible implementation(s)
Adding a new key to BlitzConfig named queryClient that accepts
DefaultOptions
from React Query might be the best way to approach this. Then when Blitz initializes a newQueryClient
the options can be merged. I think we would want to figure out if we should allow overriding of the current settings Blitz provides which arequeries.suspense
andqueries.retry
Additional context
While the default options will work for 90% of the use cases, this is a simple addition that will allow for more flexible use cases for Blitz.