Closed Evertt closed 3 years ago
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
.