Skip to content

Binding to store value properties causes addition change per binding #5555

Closed
@techniq

Description

@techniq

Describe the bug
When binding to a property of a store value, the value is updated / changed (subscribe called) for each bind statement, instead of just once for the initialization.

To Reproduce
REPL: https://svelte.dev/repl/83c80ca45be54486ae7fd15827660280?version=3.29.0

image

In the REPL, I would expect "pagination changed!" to be logged once when initialized, but it is being logged 3 times (2 additional times due to each bind:).

After the initial 3, only a single subscribe is called when changing anything on the store, as expected.

Expected behavior
I would expect a single call to subscribe on initialization, instead of 1 + (number of `bind:` properties)

Information about your Svelte project:

  • Svelte version: 3.29.0

Severity
In my application, this is causing all my HTTP requests to fire multiple times on init due to the changing store value, which makes this a rather significant issue for my project.

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