Skip to content

Svelte 5 may not auto-unsubscribe from a store #9346

@7nik

Description

@7nik

Describe the bug

Svelte 5 may not unsubscribe from a store despite it being not accessible anymore.

Reproduction

REPL

  1. Add and remove a watcher
  2. Change the number

A log message appears though the store is inaccessible.
Svelte 5 unsubscribes only when a new store assigned to watcherA;

If {$watcherA} appears outside the if block, the bug doesn't occur.

Logs

No response

System Info

Svelte 5 REPL

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions