Shu Ding
Shu Ding
The hardest part about this is that every library has its own API. You can pass a controller to the fetch function but there’s no general way to do it...
For now a custom hook can (partially) solve it: ```js function useCancelableSWR (key, opts) { const controller = new AbortController() return [useSWR(key, url => fetch(url, { signal: controller.signal }), opts),...
I have a new proposal here: #1933, feedback welcome!
I think this should be the correct behavior of `revalidateOnMount: false`. When the key changes, it should not automatically revalidate if `revalidateOnMount` is manually disabled.
Reopened the issue since the following should be the correct behavior. When the key changes, useSWRImmutable should definitely refetch. > More clear, I want using useSWRImmutable and can revalidateOnKeyChange to...
Thank you @icyJoseph — the implementation looks great! One more thing I think we should include in the test is reflecting the `updatedAt` state change in other hooks, that are...
> Here, broadcastState is called twice, `src/utils/mutate.ts` wouldn't it be enough to get `Date.now()` before calling broadcast state in these cases? It's a bit tricky, since the `updatedAt` state only...
This is the behavior by design, because we use `undefined` in SWR as the “no data has been resolved” state. And then, in Suspense that will naturally result in the...
@pkellner I just checked your example, and it turns out that since React 18 now supports Suspense on the server side, that `fetch('/api/cities')` will happen on the server. So I...
I will keep this issue open until we add more clarification and guidance on Suspense and SSR to the documentation. Let me know if there's any suggestion on this!