ottomated / trpc-svelte-query

66 stars 9 forks source link

ssrInfinite doesnt seem to work #15

Open juztim opened 11 months ago

juztim commented 11 months ago

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.

ottomated commented 8 months ago

Please post a MVR using codesandbox or similar :)

juztim commented 6 months ago

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/