You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the PreloadQuery, you will get a TypeScript error if you're trying to set the value of fetchPolicy to something other than cache-first. nextFetchPolicy is typed to always be undefined.
Yes, that's intended, although we might change that one allowed default soon due to implementation changes. Generally, you shouldn't touch it for PreloadQuery, whichever default we choose it probably the only one that will work as expected.
PreloadQuery works by querying data in your RSC implementation and transporting that over into SSR and the Browser clients. There, that data needs to be picked up by the useReadQuery hook without starting an additional network request.
That's why in this current implemtentation we opt for cache-first, which will on the server force a network request (so we have something we can transport) and in the client will force a cache read so you get the transported data.
That will change in the next release as we reworked PreloadQuery and the internal data transport, but again, there we will be limiting you to the fetchPolicy that works best.
If you want to cache things on the RSC level, please see your framework's network layer caching - PreloadQuery will always operate on an empty cache to ensure that no data from other queries bleeds into the query that should be transported.
Similar things for nextFetchPolicy, which would cause unintended additional network requests in this data transport scenario or (if you specify the callback function notation) would even be non-serializable and couldn't be transported.
Generally: even if you ignored the TypeScript errors - we will override whatever you specify here with values that we allow for on a TS level.
When using the PreloadQuery, you will get a TypeScript error if you're trying to set the value of
fetchPolicy
to something other thancache-first
.nextFetchPolicy
is typed to always beundefined
.Is this intended?
The text was updated successfully, but these errors were encountered: