sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.63k stars 4.13k forks source link

svelte set bound property to undefined when destroy the list component #13025

Open NikolayMakhonin opened 1 month ago

NikolayMakhonin commented 1 month ago

Describe the bug

Svelte sets the value of a bound property to undefined when it removes a list component. Thus, simply opening/closing a window can damage the data.

I created a minimal example to reproduce this error. If you remove or simplify anything else there, the error will most likely stop appearing.

When you press the button, this code is executed:

items.set([new ItemData()])
showList.set(false)

The items list is completely changed, and we immediately hide the list component.

Next, you can see in the console that the value property was set to undefined, but I didn't ask for this.

Reproduction

https://svelte.dev/repl/ba76a57dd23847e7a0be5123cfe28d22?version=4.2.19

Logs

No response

System Info

https://svelte.dev/repl/ba76a57dd23847e7a0be5123cfe28d22?version=4.2.19
Google Chrome Version 127.0.6533.120
Microsoft Windows [Version 10.0.19045.4780]

Severity

annoyance

paoloricciuti commented 1 month ago

This seems to be fixed by svelte 5

REPL