Describe the bug
In a new Svelte Kit project I have a <script context="module"> in __layout.svelte.
The load function in it is called on each page I change.
I thought instead it was only called when the layout is instantiated for the first time.
I'm doing it wrong?
How do I make a script run only the first time the layout is instantiated and not all subsequent pages (which inherit that layout)?
Reproduction
https://github.com/frederikhors/issue-svelte-kit-layout-context-module-load-always-called
System Info
System:
OS: Windows 10 10.0.19043
Binaries:
Node: 14.17.3 - C:\Program Files\nodejs\node.EXE
npm: 7.19.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
@sveltejs/kit: 1.0.0-next.117 => 1.0.0-next.131
svelte: 3.38.3 => 3.38.3
Severity
annoyance