Skip to content

Values in an outro transition are sometimes determined at render time #5264

Open
@mosheduminer

Description

@mosheduminer

Describe the bug
Values in an outro (out:) transition are sometimes determined at render time, rather than at transition time. More specifically, this happens when the the outro is on elements in an #each block. I have determined that this is indeed the case by putting logs in the svelte transition code.

To Reproduce
A REPL of the bug can be found here:
https://svelte.dev/repl/1ad9b6b4883e4b92bb679418a529ea00?version=3.24.1

While normal behavior can be found here:
https://svelte.dev/repl/ad9931c0bfb1420aadec3180202bf6bd?version=3.24.1

Expected behavior
In the bug repl, the outro transition should always match the outX variable, which is set to a negative value when "next" is clicked, and a positive value when "prev" is clicked. This would be similar to the behavior in the second repl (demonstrating normal behavior), where the outro always matches the value of y.
Instead, the outro always matches the previous value of outX, resulting in the outros occasionally moving in the wrong direction.

Severity
This bug causes problems trying to make a carousel component. It is not blocking me personally, but it was reported on discord.

Additional context
This bug was originally reported by @levyadams on discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions