trpc-svelte-query icon indicating copy to clipboard operation
trpc-svelte-query copied to clipboard

ssrInfinite doesnt seem to work

Open juztim opened this issue 1 year ago • 2 comments

Normal pre fetching using ssr works fine. However pre fetching an infinite query doesnt seem to have any effect. I logged the data in my +page.server.ts and the data that ssrInfinite returns is correct but as soon as the page renders the initial infinite query data gets fetched again, the prefetched data gets overriden and its basically the same as if the pre fetching never happened.

juztim avatar Dec 20 '23 17:12 juztim

Please post a MVR using codesandbox or similar :)

ottomated avatar Feb 28 '24 17:02 ottomated

Hi, sorry for the late reply. The issue is that stuff like getNextPageParam are missing on the data when its fetched on the server which breaks the client entirely because it needs that function when using an infinite query image

This results in

chunk-4VWQFPDV.js?v=65859a4a:1495 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length') at getNextPageParam (chunk-4VWQFPDV.js?v=65859a4a:1495:27) at hasNextPage (chunk-4VWQFPDV.js?v=65859a4a:1516:10) at InfiniteQueryObserver.createResult (chunk-4VWQFPDV.js?v=65859a4a:2449:20) at InfiniteQueryObserver.updateResult (chunk-4VWQFPDV.js?v=65859a4a:2076:29) at InfiniteQueryObserver.setOptions (chunk-4VWQFPDV.js?v=65859a4a:1899:10) at InfiniteQueryObserver.setOptions (chunk-4VWQFPDV.js?v=65859a4a:2410:11) at new _a9 (chunk-4VWQFPDV.js?v=65859a4a:1833:10) at new InfiniteQueryObserver (chunk-4VWQFPDV.js?v=65859a4a:2402:5) at createBaseQuery (chunk-4VWQFPDV.js?v=65859a4a:2694:20) at createInfiniteQuery (chunk-4VWQFPDV.js?v=65859a4a:2754:10) Navigated to http://localhost:5173/

juztim avatar May 02 '24 12:05 juztim