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
If a component is dynamically created inside an onMount handler, it triggers an infinite loop whereby onMount is called over and over until the app crashes.
Logs
Console will output Maximum call stack size exceeded.
Expected behavior
Component is created at target site without an infinite loop.
Severity
Seems pretty bad if you are looking to do this sort of thing.
Additional context
Spent a little bit debugging this and it looks like the component creation triggers a call to flush() which then calls the onMount because it hasn't been removed from the queue yet. The seen_callbacks set which is supposed to protect against recursion does nothing in this case because it is constantly reset to empty upon entry.
The text was updated successfully, but these errors were encountered:
Describe the bug
If a component is dynamically created inside an
onMount
handler, it triggers an infinite loop wherebyonMount
is called over and over until the app crashes.Logs
Console will output
Maximum call stack size exceeded.
To Reproduce
https://svelte.dev/repl/308f355e52e740b99834853a5edd6db8?version=3.17.3
Credit to @tivac for coming up with a repro.
Expected behavior
Component is created at target site without an infinite loop.
Severity
Seems pretty bad if you are looking to do this sort of thing.
Additional context
Spent a little bit debugging this and it looks like the component creation triggers a call to
flush()
which then calls theonMount
because it hasn't been removed from the queue yet. Theseen_callbacks
set which is supposed to protect against recursion does nothing in this case because it is constantly reset to empty upon entry.The text was updated successfully, but these errors were encountered: