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
which return isServer: true and therefore throw an error.
The problem is that in the context of Next.js we need to wait for component mount before being able to use a global browser variable (See this thread for more details)
So here comes the paradox:
we need to wait for component to mount before calling useFetch(url, { persist: true }, [])
we need to call the hook at every render and cannot wait for some conditions to be fulfilled
A potential solution might be to make the check on isServer optional for Next.js users.
The text was updated successfully, but these errors were encountered:
Getting the error
There is no persistent storage on the Server currently
when usinguseFetch
withpersist: true
in a Next.js app:This is due to the use of
useSSR
here:use-http/src/useCache.ts
Line 16 in 8a85089
which return
isServer: true
and therefore throw an error.The problem is that in the context of Next.js we need to wait for component mount before being able to use a global browser variable (See this thread for more details)
So here comes the paradox:
useFetch(url, { persist: true }, [])
A potential solution might be to make the check on
isServer
optional for Next.js users.The text was updated successfully, but these errors were encountered: