-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: reset invalid resources after successful invalidation #11268
Conversation
🦋 Changeset detectedLatest commit: b0a6ac9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hi, this PR is most likely the culprit for #11461 (and maybe #9355 (comment)) which triggers multiple (at least 2) versions of $page concurrently living in client even on a Svelte4 build, which is a quite sneaky bug I think more people are affected by it than reported (in our case it took several days for a user to report it despite careful inspection first). Coincidentally or not this PR also solves #10359 which I tried to debug a few days ago (before migrating to SK2 then noticing it was solved) and came to the same conclusion as @Rich-Harris ( Before that PR the reset of kit/packages/kit/src/runtime/client/client.js Line 1063 in b2b1951
which had the effect of calling What I understand of it with my limited knowledge is that now the parent "page" is never really "loaded" (in I don't know the history of the file but having the reset there instead of the obvious place this PR moves it felt like there was a reason for it (maybe this one). The fix I found (in SK1) was to check if the parent had changed before flagging the dependencies to be invalidated in // has_changed()
if (!parent_changed) {
for (const href of uses.dependencies) {
if (invalidated.some((fn) => fn(new URL(href)))) return true;
}
} and let the reset where it was. I didn't do enough testing to make sure it was the right fix (although all tests seemed to pass, although at least one seems to be missing). I could try to help if needed! |
@gterras Did you find any fix in SK2? The fix you sent only works if I remove the newly-added |
Didn't have time to look into it yet (also not sure if a working PR would be acknowledged or awkwardly ignored by the team) but a fully working fix would definitely need more than that. Crucially it also needs least two tests first (double invalidation + unsync parent $page). As said in my first comment the initial placement of the invalidation reset is weird enough to be there for a reason. I suspect invalidation has never really properly worked in SK history. This PR also doesn't remove the old reset which seems to be there "just in case" which seems to show invalidation logic is fully understood by no one. I'll try to look into it soon if I find the time. |
closes #10677
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.