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

Error in destructuring let on non-let content update #2751

Closed
simonbuchan opened this issue May 14, 2019 · 2 comments · Fixed by #4149
Closed

Error in destructuring let on non-let content update #2751

simonbuchan opened this issue May 14, 2019 · 2 comments · Fixed by #4149
Labels

Comments

@simonbuchan
Copy link

See repl example

When externally updating the content of a component with a let binding (e.g. not due to a change of the let binding), and the binding has a destructuring expression, the destructuring expression is evaluated with undefined, which will cause an error.

In the example, note that the first <Await/> block does not destructure, and works correctly when the Increment button is pressed, while the second third, otherwise identical except for the destructuring, causes the error when the Increment button is pressed:

VM516:738 Uncaught (in promise) TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at Array.Await.props.$$slots.default (eval at handle_message (VM365 about:srcdoc:68), <anonymous>:738:36)
    at get_slot_changes (eval at handle_message (VM365 about:srcdoc:68), <anonymous>:63:64)
    at Object.update [as p] (eval at handle_message (VM365 about:srcdoc:68), <anonymous>:470:21)
    at Object.update [as p] (eval at handle_message (VM365 about:srcdoc:68), <anonymous>:558:17)
    at update (eval at handle_message (VM365 about:srcdoc:68), <anonymous>:173:16)
    at flush (eval at handle_message (VM365 about:srcdoc:68), <anonymous>:143:5)
@fschuetz04
Copy link

I also came across this issue while working on a drag and drop component. I created a simpler example here; https://svelte.dev/repl/cf7c98699d5a495b96945e42a63ffeed?version=3.12.1.

@Conduitry
Copy link
Member

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

Successfully merging a pull request may close this issue.

3 participants