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

Order is wrong for keyed each block with outros #543

Closed
Rich-Harris opened this issue May 1, 2017 · 2 comments
Closed

Order is wrong for keyed each block with outros #543

Rich-Harris opened this issue May 1, 2017 · 2 comments
Labels

Comments

@Rich-Harris
Copy link
Member

No REPL demo until #525 is released, but if you have a situation like this...

{{#each things as thing @name}}
  <div out:fade>{{thing.name}}</div>
{{/each}}

...then when you remove an item from the middle of things, the corresponding DOM node jumps to the top of the list. That's because Svelte mounts all iterations that correspond to the current value of things, in order, to whatever the anchor node is — it doesn't mount outroing nodes, with the effect being that everything preserved or created appears below everything outroing.

There isn't really a neat solution to this — instead we'll need to implement #373.

Rich-Harris added a commit that referenced this issue May 6, 2017
Rich-Harris added a commit that referenced this issue May 6, 2017
ensure outroing each block iterations don't jump to the top
@Rich-Harris
Copy link
Member Author

This is mostly fixed in 1.20 — REPL. However it seems that if you bash the 'randomise' button in the example enough times, you can get into a corrupted state (one of the letters on the left hand side will stick around when it should have been removed). Haven't yet managed to create a minimal repro that we can work with — if anyone is able to, that would be a huge help!

@Rich-Harris
Copy link
Member Author

I think this might have been fixed by some of the recent work on transitions, I can no longer reproduce it. Will be optimistic and close it

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

No branches or pull requests

1 participant