You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you click on the "Change $session" button, you'll see the message "index load function" appearing in the console, which obviously means the load function is re-run, even though session isn't used in the load function. This is inconsistent with the behavior described in the docs.
The strange thing, however, is that from the second time onwards, when the value of the '$session' store changes, the load function is no longer re-run. This is confusing.
The more severe bug, however, which seems to be related to this one, is that every time the $session store changes, the page's props are apparently re-set, which means reactivity is re-triggered throughout the entire page, potentially causing massive problems.
In this setup, whenever you click on the "Change $session" button — which is to say whenever you update the $session store — the fetch request in the markup, which uses the userBaicInfo prop, is re-triggered, even though it obviously shouldn't. And you can see the userBasicInfo changed: ... message in the console which proves that it's because of the userBasicInfo prop getting re-set.
Reproduction
You can create an empty SvelteKit skeleton project and then copy-paste the two code snippets above into the index.svelte file, and then npm run dev => open your browser and see the behavior for yourself.
@babichjacob Well, I didn't get a response in that issue even though pretty much all of the issues that were created after mine did, I thought maybe there's something wrong.
@Aaron2321d - Yes, wait for someone to have time to look at your issue. There are a limited number of Svelte maintainers and volunteers. If you want attention to an issue, mentioning it on the #svelte or #svelte-kit channel (as appropriate) on the Discord would be appropriate, as long as you don't do so too often. No more than once a week would be my recommendation.
That said, you don't need to do so right now, as I'm taking a look at #3732 now and I'll post my findings when I'm done.
Describe the bug
In the docs, in the section about the
load
function, it's stated that:But this doesn't seem to be the case. I have the following page in my SvelteKit app:
index.svelte
:If you click on the "Change $session" button, you'll see the message "index load function" appearing in the console, which obviously means the load function is re-run, even though
session
isn't used in theload
function. This is inconsistent with the behavior described in the docs.The strange thing, however, is that from the second time onwards, when the value of the '$session' store changes, the
load
function is no longer re-run. This is confusing.The more severe bug, however, which seems to be related to this one, is that every time the
$session
store changes, the page's props are apparently re-set, which means reactivity is re-triggered throughout the entire page, potentially causing massive problems.Consider the following:
In this setup, whenever you click on the "Change $session" button — which is to say whenever you update the
$session
store — thefetch
request in the markup, which uses theuserBaicInfo
prop, is re-triggered, even though it obviously shouldn't. And you can see theuserBasicInfo changed: ...
message in the console which proves that it's because of theuserBasicInfo
prop getting re-set.Reproduction
You can create an empty SvelteKit skeleton project and then copy-paste the two code snippets above into the
index.svelte
file, and thennpm run dev
=> open your browser and see the behavior for yourself.Logs
No response
System Info
Severity
blocking all usage of SvelteKit
The text was updated successfully, but these errors were encountered: