Skip to content

Reactivity Breaks When Using $state in Both a Function and a Svelte Component #15169

@signalize

Description

@signalize

Describe the bug

When defining a function in a .svelte.ts file that creates and returns a $state object, everything works as expected when using the function in a .svelte file. However, if the same .svelte file contains another $state definition, the reactivity of the $state object from the function breaks.

Reproduction

See the following branch to test:
https://github.com/signalize/svelte-state-issue

Logs

System Info

svelte: ^5.0.0 => 5.19.6

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