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
The component suspends, the fallback renders, then on resolution of the query it displays the error.
Actual behavior
The component suspends, rerenders, then suspends again. This repeats indefinitely
Root Cause
The @urql/exchange-suspense package has not been kept up-to-date and we should consider moving suspense support back into mainline stable, and not experimental. @StevenLangbroek: Let me know if anything else is still causing trouble that we can address with this issue too, e.g. unexpected results after the latest changes on main.
The exchange should hold on to a result for one tick until the component re-renders at which point it can then reuse the result. I suspect that the double-subscription approach to initialise the effect subscription erases the result stored by the suspenseExchange before the component fully mounts, thus triggering suspense again.
The text was updated successfully, but these errors were encountered:
I believe the first step to investigating this which is a good stepping point is to write React Test Rendering unit tests for the suspense package, so I'll start with that and we'll go from there. This should show us the regression and prevent us from regressing in the future, so we can bring this package back from being marked as experimental or generally as a "bad idea" and officially support client-side suspense again.
With #1123 I believe I've found a solution that fixes all edge-cases related to client-side suspense and removes the requirement to add the suspenseExchange entirely. I've moved the suspense implementation away from @urql/core and the Client and instead to useQuery. It's noteworthy that if an uncached result is being fetched using Suspense on the client-side that urql will attempt to update the result on mount since it hasn't been cached. This however does not lead to a loop anymore.
Originally reported by @StevenLangbroek
Summary
Steps to reproduce
suspenseExchange
See: https://github.com/StevenLangbroek/urql-suspense-loop-repro/tree/c8c88f42687e4f2c9ccc7839fa1526e13540769d
Expected behavior
The component suspends, the fallback renders, then on resolution of the query it displays the error.
Actual behavior
The component suspends, rerenders, then suspends again. This repeats indefinitely
Root Cause
The
@urql/exchange-suspense
package has not been kept up-to-date and we should consider moving suspense support back into mainline stable, and not experimental. @StevenLangbroek: Let me know if anything else is still causing trouble that we can address with this issue too, e.g. unexpected results after the latest changes onmain
.The exchange should hold on to a result for one tick until the component re-renders at which point it can then reuse the result. I suspect that the double-subscription approach to initialise the effect subscription erases the result stored by the
suspenseExchange
before the component fully mounts, thus triggering suspense again.The text was updated successfully, but these errors were encountered: