ConsoleTVs / sswr

🔥 Svelte stale while revalidate (SWR) data fetching strategy
MIT License
243 stars 12 forks source link

[HELP] Error: Function called outside component initialization #38

Open psociety opened 2 years ago

psociety commented 2 years ago

Hi! Thank you for creating SSWR!

I'm getting Error: Function called outside component initialization but i can't understand why. SSWR is called inside onMount. onMount -> wrapper method -> SSWR.

Error trace: image

Where it starts: image

Wrapper method: image

Versions:

"svelte": "^3.49.0",
"svelte-preprocess": "^4.10.6",
"vite": "^3.0.2",
"sswr": "^1.7.0",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.44",

I don't use SvelteKit

What i'm missing out? What i'm doing wrong? Cant SSWR be used inside promises?

Edit: I've tried upgrading "@sveltejs/vite-plugin-svelte": "^1.1.0", but didnt make any change.