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
Describe the bug
It seems that when an element within the :then block of an #await statement is updated after the first rendering, the error variable from the :catch block somehow "leaks" and overwrites other variables or causes an exception.
E.g. if you use {:catch error}, and the {:then} block also uses a variable named "error" things start to get weird.
In my actual application I have a "global" component variable named "error" that suddenly seems to hold the value of the awaited promise in some cases; and in other cases an exception is thrown within svelte.
I also think this is a bug. In this repl the error variable is overridden by the resolved result of the promise. It only happens inside the await then block after an update happens.
Describe the bug
It seems that when an element within the :then block of an #await statement is updated after the first rendering, the error variable from the :catch block somehow "leaks" and overwrites other variables or causes an exception.
E.g. if you use {:catch error}, and the {:then} block also uses a variable named "error" things start to get weird.
In my actual application I have a "global" component variable named "error" that suddenly seems to hold the value of the awaited promise in some cases; and in other cases an exception is thrown within svelte.
To Reproduce
An exception will be triggered when clicking the button in this REPL; make sure to open e.g. Chrome Dev Tools before clicking the button.
The issue started in 3.25 - it worked fine with 3.24.1
https://svelte.dev/repl/95746deee9e34eb8b45a02a673e00136?version=3.37.0
Expected behavior
The naming of the error variable for the {:catch} block should not affect the :then block in any way; it should be scoped correctly.
Severity
Blocks update / would require renaming of variables in many component.
The text was updated successfully, but these errors were encountered: