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

transition: and indexed {#each} block race condition #13926

Closed
GauBen opened this issue Oct 25, 2024 · 4 comments · Fixed by #13930
Closed

transition: and indexed {#each} block race condition #13926

GauBen opened this issue Oct 25, 2024 · 4 comments · Fixed by #13930

Comments

@GauBen
Copy link
Contributor

GauBen commented Oct 25, 2024

Describe the bug

I found a very weird edge case that only seems to happen when a lot of unusual conditions align (indexed each, transitions, timings, focus...).

Here is a very minimal "autocomplete" implementation:

When one suggestion is clicked, new suggestions appear by calling this replacement snippet list.set(['three', 'four'])

expected:

actual:

Old suggestions are not properly removed from the DOM

Reproduction

https://svelte.dev/playground/1841f931f328483283516f946b1a44e0?version=5.1.2

Very small changes can make it work properly:

  • Moving onfocusin to the <input/> element
  • Removing the index in the {#each block}
  • Removing the 4ms delay in updateList

Logs

No response

System Info

Svelte 5.1.2

Severity

annoyance

@GauBen
Copy link
Contributor Author

GauBen commented Oct 25, 2024

After a quick investigation, the bug appeared in 5.0.0-next.269 (https://github.com/sveltejs/svelte/blob/main/packages/svelte/CHANGELOG.md#500-next269), it works fine before this release

@adiguba
Copy link
Contributor

adiguba commented Oct 25, 2024

The PR #13646 is realy simple and only affect dynamic component, which are not used in your example.

Also, the bug seem already present on version 5.0.0-next.268 :
https://svelte.dev/playground/1841f931f328483283516f946b1a44e0?version=5.0.0-next.268

Using the REPL, I see that it was rather introduced in 5.0.0-next.263 :
https://svelte.dev/playground/1841f931f328483283516f946b1a44e0?version=5.0.0-next.262 => OK
https://svelte.dev/playground/1841f931f328483283516f946b1a44e0?version=5.0.0-next.263 => BUG

@trueadm
Copy link
Contributor

trueadm commented Oct 25, 2024

Maybe it was #13527?

@GauBen
Copy link
Contributor Author

GauBen commented Oct 25, 2024

Thank you a lot for your help @adiguba! Somehow in my original SvelteKit app the bug started to appear on a later Svelte version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants