Skip to content

Order of Component-Updates when more than one store has a new value #8151

@michAtEl

Description

@michAtEl

Describe the bug

I think I found a case in which Svelte updates components in the wrong order.

Reproduction

https://svelte.dev/repl/207e33065bdb41dcb53bfe8ebcfb8ced?version=3.55.0
Click the Button "remove".

There is an Error on the console: "Cannot read properties of undefined (reading 'points')"

In handleClick() (App.svelte):
Because of selected.set(...) all instances of ConnectionPoint will update in the next microtask.
Because of connections.set(...), some of these instances of ConnectionPoint should not exist any more, but Svelte tries to update them, before it updates the instances of Connection. This leads to the Error.

The problem would be solved, if Svelte would update the components in this order:

  • first: App
  • then: all instances of Connection (this should remove all instances of ConnectionPoints, that should not exist any more)
  • then: all instances of ConnectionPoints

Logs

No response

System Info

repl, Svelte 3.55.0

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions