-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: guard contents updated before the guard itself #16930
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 41565da 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 |
b16146d
to
ac85e4a
Compare
|
It seems like this fixes the issue described here - but only for its first occurrence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what the tests are supposed to test? Most (haven't checked all but the first 4 do) also pass on main, and some of them have if conditions that are never true.
I think we should reduce this only to the ones that pass with this PR but fail on main.
The tests I committed were falling (multi-nested was failing against that pr), but I didn't look too closely at the tests commit I cherry picked from the previous PR. I'll clean those up and take a stab at @PatrickG's issue today. |
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
It looks like sorting eager effects by depth does fix this issue, so that may be necessary after all. |
Fixes #16850, #16775, possibly #16795
#16631 introduced a bug that results in the effects within guards being evaluated before the guards themselves. I believe iterating the effects in reverse fixes the issue without any further regressions. An alternative approach could be to actually sort effects by depth before updating, but I suspect that would have a greater performance penalty.
Although all tests pass, sorry if I'm missing something obvious! I've never touched the Svelte internals until now :).
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint