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
I also don't recommend mutate being used with useTransition for what I think you want. SWR will not allow you to mock a delayed fetching of data easily because it's supposed to fetch (cached or new) data fast.
Here's code I wrote of what I think you're looking for.
Thanks @angeeeeelh , initially I wanted to wrap mutate with useTransition to avoid triggering suspense repeatedly. Later, I realized that mutate does not trigger suspense, and I can directly use isValidating to determine whether data is being re-fetched.
I wonder if this means that SWR's suspense mode only triggers suspense during the initial data fetch, and subsequent mutate or revalidation is always a "transition". Therefore, SWR neither needs nor can work with useTransition.
Bug report
Description / Observed Behavior
Pending state flashed briefly, expected to persist for 1 second.
Repro Steps / Code Example
https://codesandbox.io/p/sandbox/swr-suspense-wrzxgn
Additional Context
SWR version: 2.3.3
The text was updated successfully, but these errors were encountered: