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
constpromiseHandler=Promise.resolve(promise).then(data=>({success: true, data })).catch(error=>({success: false, error }))promiseHandler.then(result=>{if(result.success){// Pass successful promise as initialPromisequery.fetch(undefined,{initialPromise: promise})}else{// Don't pass failed promise - allows client retryconsole.log('Server failed, client will retry')}})
Question
I saw #9633 tried something similar but was closed.
You mentioned concerns about it "failing in the normal case of a successfully streamed infinite query."
Does my approach handle both cases correctly?
The key difference is I only skip initialPromise on failures, so successful prefetches should still work.
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.
-
Hi @TkDodo,
I've been looking into #8825 and think I found the root cause. Want to run my approach by you before submitting a PR.
Setup I tested
Server prefetch: fails with 500
Client fetch: succeeds
Result: Works! Data shows up after client retry
What's happening
DehydratedQuery doesn't track if it's an infinite query
Regular queries work, but infinite queries lose their behavior
The rejected promise prevents client-side refetch
Proposed fix
Question
I saw #9633 tried something similar but was closed.
You mentioned concerns about it "failing in the normal case of a successfully streamed infinite query."
Does my approach handle both cases correctly?
The key difference is I only skip initialPromise on failures, so successful prefetches should still work.
Should I:
I've reviewed:
dehydrate.tsandhydrate.tsin query-coreinfiniteQueryBehaviorimplementationLet me know what you think!
Beta Was this translation helpful? Give feedback.
All reactions