Skip to content

Svelte 5: $derived variables become Symbol() when component unmounts #9409

@robertadamsonsmith

Description

@robertadamsonsmith

Describe the bug

If a component is unmounted, any $derived variable will unexpectedly change to Symbol().

This is only an issue when a $derived variable is accessed asynchronously after the component has been unmounted, such as from a setInterval function, and so it is not clear what the behaviour should be.

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACo1QwU7EIBT8FUQP3aRp12tta7zpWW_ioZbHLpFCA681hvDvAq0aPXmCGd7Mm8FTIRU42jx7qocJaEPv5pmWFD_mBNwKCiFiZxY7JqZ1o5Uz9kwzlNNsLJIncEiENRNhtKoTqjYdo2lKARJ3Nu-kI1cOB4QC7QKHG6bb-sdMt68LotHE6FHJ8a3zxaHrd91FOkPvM7yNa-4lj-6kidfHyDEa2nrTZy9_KUXeGVKANges44uvpQixzWS4FBI4bVKUUH6XT5P_bL83E1JLdwae2nGwcgVeiEG5XDANOcAHjWDXQRWpkk8kw9FoZxRUypyKL48swVCS6-Nxk__6oT3cn_Av4RMagrCqxQEAAA==

Click on the Hide button, and see that Symbol() is output in the console instead of false

Logs

No response

System Info

svelte-5-preview.vercel.app

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