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
SWR 2.2.5.
Happens with strict mode and without.
When suspense is false then subscribe() gets called. You can try that out with the Codesandbox repro above.
This is almost certainly because this invocation of useSWRNext() with no fetcher pulls an infinite loop when suspense is true
Bug report
Description / Observed Behavior
When configured with
{ suspense: true }
,useSWRSubscription
will render repeatedly, suspend indefinitely, and never callsubscribe()
.Expected Behavior
I would expect
useSWRSubscription
to suspend until the first timenext()
is called with data.Repro Steps / Code Example
Codesandbox repro (WARNING: infinite render loop)
Additional Context
SWR 2.2.5.
Happens with strict mode and without.
When
suspense
isfalse
thensubscribe()
gets called. You can try that out with the Codesandbox repro above.This is almost certainly because this invocation of
useSWRNext()
with no fetcher pulls an infinite loop whensuspense
istrue
https://github.com/vercel/swr/blob/main/src/subscription/index.ts#L38
The text was updated successfully, but these errors were encountered: