Skip to content
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

Infinite loop detected triggered in async loops #6945

Closed
GauBen opened this issue Nov 19, 2021 · 3 comments · Fixed by #6963
Closed

Infinite loop detected triggered in async loops #6945

GauBen opened this issue Nov 19, 2021 · 3 comments · Fixed by #6963
Labels
compiler Changes relating to the compiler feature request

Comments

@GauBen
Copy link
Contributor

GauBen commented Nov 19, 2021

REPL example

The code is roughly as follows:

<script>
  let pages = []
  $: if (search.length > 0) {
    while (! allPagesLoaded) {
      pages = [...pages, await loadPage(previousPage)]
    }
  }	
</script>

Exact code

Since the loadPage function is slow to complete, the loop guard throws an exception, despite the loop not being infinite.

@Conduitry Conduitry transferred this issue from sveltejs/svelte-repl Nov 19, 2021
@Conduitry Conduitry added compiler Changes relating to the compiler feature request labels Nov 19, 2021
@Conduitry
Copy link
Member

Moving this to the svelte repo as a feature request to update the loop guard feature ... somehow. Maybe disable it for loops inside async functions?

@Conduitry
Copy link
Member

This should be fixed in 3.44.3 - https://svelte.dev/repl/cd92d7b053f04ce981ad9a3871cdc5cd?version=3.44.3

@GauBen
Copy link
Contributor Author

GauBen commented Dec 22, 2021

I'm not sure if the fix works in this case, the example still displays "Infinite loop detected"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Changes relating to the compiler feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants