-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue during SSR, fetch not defined #6
Comments
Same problem. |
Hey guys, can we elaborate a bit on the problem? I have never used ssr. What is the intention of it, should it automatically fetch on server first and then client? |
Yeah the idea is that it fetches on the server first so that it can deliver pre-rendered html to the client. And after that the client takes over. So on the server I want to be able to configure swr to use node-fetch. |
Hey guys, got an update for you all. I am no expert at SSR, and since sveltekit is still in beta I don't want to get into it. So for now, what I made is make it work with any SSR solution but without actually fetching on the server. Instead, sswr will only fetch on the client. Hope this fix works for your current applications. I am happy to get any PR. This library is fairly simple at the end of the day. I've also fixed a few typescript generic paramenters. Please try version: 1.2.0 Have a nice day! |
This issue happens in SvelteKit and I presume also in Sapper.
This issue could relatively easily be mitigated if
createSWR()
wasn't automatically called. Then a developer like me could choose not to call it during SSR, or to call it with a specialfetcher
.The text was updated successfully, but these errors were encountered: