-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Assignments inside {#if} cause inconsistent state #6007
Comments
The |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Since it has already been confirmed and labeled as bug, I don"t think it makes sense to close this as stale just because it didn"t make it out of the backlog yet... |
It look like this bugs still here in the newest version. I"ll take a crack at it, but I"m new so I would appreciate pointers if anyone knows where I should look. |
Describe the bug
Assignments inside of an
{#if}
(which can be useful if the value being assigned is the return value of a function and it should be checked and used without calling the function twice) create an inconsistent state: The correct value is rendered, but event handlers see an old value.To Reproduce
Check this REPL: https://svelte.dev/repl/f24c001c7e284906a61d215b02dd0928?version=3.32.3
Note that the alert says
foo
when clicking the button, despite the button text itself sayingbar
.Expected behavior
Alert should say
bar
.Severity
Not causing any immediate issue for me, I can work around it.
The text was updated successfully, but these errors were encountered: