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 have been receiving stale error states from SWR when navigating back to a page after a login ( SWR reports an error, page redirects, using logs in setting tokens, and then navigates back to the page, the error is still set and displays an error until the SWR fetch result has been completed, this can take a second or so where my "Not Authorized" page is present until its refreshed.)
To rectify this the only way i can seem able to do this is clear the cache using mutate(() => true, undefined, { revalidate: false }); to initiate a "new" session.
But it seems to me that errors should not be cached anyway? if a previous error exists in the cache, should useSWR immediately re-fetch, clearing the cache and setting {isLoading } - if not, is there a flag I am missing that would force such a thing on the hook itself?
Perhaps I am miss understanding the flow?
The text was updated successfully, but these errors were encountered:
I have been receiving stale error states from SWR when navigating back to a page after a login ( SWR reports an error, page redirects, using logs in setting tokens, and then navigates back to the page, the error is still set and displays an error until the SWR fetch result has been completed, this can take a second or so where my "Not Authorized" page is present until its refreshed.)
To rectify this the only way i can seem able to do this is clear the cache using
mutate(() => true, undefined, { revalidate: false });
to initiate a "new" session.But it seems to me that errors should not be cached anyway? if a previous error exists in the cache, should useSWR immediately re-fetch, clearing the cache and setting {isLoading } - if not, is there a flag I am missing that would force such a thing on the hook itself?
Perhaps I am miss understanding the flow?
The text was updated successfully, but these errors were encountered: