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

Each data is duplicated when using transitions in await syntax #5815

Closed
itsdonnix opened this issue Dec 22, 2020 · 3 comments · Fixed by #5850
Closed

Each data is duplicated when using transitions in await syntax #5815

itsdonnix opened this issue Dec 22, 2020 · 3 comments · Fixed by #5850

Comments

@itsdonnix
Copy link
Contributor

itsdonnix commented Dec 22, 2020

Describe the bug
I try to use transitions in each of my data ({#each}) that I get after my Promise resolves. But when I re-assign it to the variable that holds the Promise, the displayed data actually increases.

Discord link => https://discord.com/channels/457912077277855764/653341885674553345/791014063496101898

svelte-bug.mp4

Logs
Nothing shows in the console

To Reproduce
https://svelte.dev/repl/99c98342054542ca9c9a82f97c0f200c?version=3.31.0
https://github.com/donnisnoni/svelte-127253y6123-bug/blob/bug/src/views/admin/rayon/Index.svelte#L54-L75
https://github.com/donnisnoni/svelte-127253y6123-bug/blob/bug/src/store/rayon.js#L22-L34

Expected behavior
The data is not duplicated/increased

Information about my Svelte project:

  System:
    OS: Linux 5.10 Linux Mint 20 (Ulyana)
    CPU: (4) x64 Intel(R) Core(TM) i3-4005U CPU @ 1.70GHz
    Memory: 445.32 MB / 3.76 GB
    Container: Yes
    Shell: 3.1.2 - /usr/bin/fish
  Binaries:
    Node: 14.15.1 - ~/nvm/node/v14.15.1/bin/node
    Yarn: 1.22.10 - ~/nvm/node/v14.15.1/bin/yarn
    npm: 6.14.9 - ~/nvm/node/v14.15.1/bin/npm
  Browsers:
    Chrome: 87.0.4280.88
  npmPackages:
    svelte: ^3.31.0 => 3.31.0 
    vite: ^1.0.0-rc.13 => 1.0.0-rc.13 

Additional context
Add any other context about the problem here.

@itsdonnix itsdonnix reopened this Dec 22, 2020
@mdynnl
Copy link

mdynnl commented Dec 23, 2020

https://svelte.dev/repl/99c98342054542ca9c9a82f97c0f200c?version=3.31.0

@mdynnl
Copy link

mdynnl commented Dec 27, 2020

after playing around in the repl
i've known a few things

  • #each doesn't cause this ( no #each in above repl )
  • out transition does
    try changing transition:name to in:name(no issue) or out:name(this one does)

current behavior(to my understanding):

  1. promise holding variable (#await promise) gets a new promise
  2. outro starts and wait for the promise to be resolved
  3. then node gets deleted after outro ends
  4. promise resolves
  5. a new node with changes comes in
  6. intro starts and ends

why and when does duplication happen?
-> when the promise resolves before the outro ends

promise is usually fetching and doesn't resolve before outro ends
old node gets deleted meaning currentNode = undefined
then new node with promise result comes in, currentNode = newNode

but when it resolves before outro ends
new node comes in currentNode = newNode
and after that, old node gets deleted currentNode = undefined

so, when the promise holder gets a new promise
the outro never plays as currentNode = undefined
but after the promise resolves
new node comes in
old node doesn't get removed

i hope this makes sense to you and helps track the bug
pardon my poor writing and explaining skills

@Conduitry
Copy link
Member

This is fixed in 3.31.2 - https://svelte.dev/repl/99c98342054542ca9c9a82f97c0f200c?version=3.31.2

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

Successfully merging a pull request may close this issue.

4 participants