Skip to content

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

Closed
@GauBen

Description

@GauBen

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions