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
I am using ensureData for route preloading. This works great for preloading data that is later loaded inside the component using useQuery, but does not seem to work as well with useInfiniteQuery.
The issue seems to be that the queryKey does not match between ensureData and useInfiniteQuery, therefore there is a cache miss and a duplicate fetch that occurs.
This would not be an issue using with vanilla react-query, since the key can be set to the same value, but TRPC manages the key for us.
Is there a workaround? Or could TRPC perhaps benefit from a complementary ensureInfiniteData helper, which uses type: 'infinite' for the key?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am using
ensureDatafor route preloading. This works great for preloading data that is later loaded inside the component usinguseQuery, but does not seem to work as well withuseInfiniteQuery.The issue seems to be that the
queryKeydoes not match betweenensureDataanduseInfiniteQuery, therefore there is a cache miss and a duplicate fetch that occurs.This would not be an issue using with vanilla react-query, since the key can be set to the same value, but TRPC manages the key for us.
Is there a workaround? Or could TRPC perhaps benefit from a complementary
ensureInfiniteDatahelper, which usestype: 'infinite'for the key?Beta Was this translation helpful? Give feedback.
All reactions