-
- Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
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.