Comments (15)
It's not a bug in this package, but in sveltekit
. I saw the same problem on my own tinkering with react-query
- so I opened a bug in sveltekit
. See sveltejs/kit#2147.
Btw, it only happens when both preconditions are true: a) lifecycle-method called inside an installed package. b) in dev-mode.
It works in svelte-repl though. So its likely a problem with the vite-dev-server.
PS: You can circumvent the bug for now by installing swrev
and copy sswr to your local $lib-folder and import it from there.
from sswr.
Strange, last time I checked it worked... I'll check
from sswr.
Wait, I just double checked by installing the remote pkg and you're right it fails. I'm going to see what's going on here... Thanks for the error report, seems it worked fine with my local pkg :D
from sswr.
I tries to fix it and i was unable to. I got to the conclusion thst it might either be a bundle issue or something related. I am not an expert but sveltekit api is not yet stable either and it is due change, ao i might either wait for some PR from people who know more about the internals, wait for sveltekit to be stable or in short, have some more free time to allocate to this
from sswr.
It's not a bug in this package, but in
sveltekit
. I saw the same problem on my own tinkering withreact-query
- so I opened a bug insveltekit
. See sveltejs/kit#2147.Btw, it only happens when both preconditions are true: a) lifecycle-method called inside an installed package. b) in dev-mode.
It works in svelte-repl though. So its likely a problem with the vite-dev-server.
PS: You can circumvent the bug for now by installing
swrev
and copy sswr to your local $lib-folder and import it from there.
That could explain why my local symlinked pkg was working lol
from sswr.
What is this node adapter?
from sswr.
Basically a build adapter that will result in an application build for NodeJs instead of a static file build.
from sswr.
Ok, looking a bit more into this, it does seem that this doesn't work with SvelteKit yet. Any idea why that might be? I just started a new project using
npm init svelte@next my-app
cd my-app
npm install
npm run dev
and tried to run the sample code, resulting in the same error described above.
from sswr.
Same here with SvelteKit.
I'm not using node adapter.
So, the adapter is not the problem here.
I think we should initialize sswr before using it and use it with setContext
/getContext
.
from sswr.
Using the steps in https://kit.svelte.dev/docs#introduction-getting-started
you can try yourself: it doesn't work.
from sswr.
I just tried and it does work... 😕
Fresh install and everything...
from sswr.
Can you please create an example
directory with the new Svelte Kit Demo project and sswr?
from sswr.
Do you have any news on this, @ConsoleTVs?
from sswr.
I think this fix it (for now): #11.
Can we close this?
from sswr.
Yes, I hope this will be fixed in the future by svelte plugin authors. Great work!
from sswr.
Related Issues (20)
- Dependent fetching just doesn't work? HOT 12
- Support synchronous `fetcher` function HOT 3
- `fetcher` is sometimes ignored and it uses the default `fetch` HOT 1
- If `fetcher` returns `null` the revalidation is ignored HOT 1
- make revalidate() fires immediately? HOT 4
- Add `isValidating` prop HOT 1
- revalidateOnMount missing? HOT 2
- Server side rendering SvelteKit example does not work
- SvelteKit - Named export 'SWR' not found HOT 3
- [HELP] Error: Function called outside component initialization
- Add option for polling interval
- Posible vite4 incompatibility HOT 2
- Multiple SWRs in one component keep resetting each other
- Dependent fetching doesn't revalidate when changing to an already cached value
- Svelte 4 support HOT 2
- Difference to @tanstack/svelte-query HOT 1
- Documentation typo: Global configuration options HOT 1
- SSWR no longer updating with longer `dedupingInterval`
- Is there a changelog?
- Quality control & maintenance of SSWR HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sswr.