Dang.

Interestingly, I did try putting a `const newValue = value` inside the callback body in your example, and even that didn't work.

It seems like the Svelte compiler should undefine functions in component bodies, to be thorough, since those functions lose their captured context. Then everything in a component would be tied to its lifecycle, not just some things.

Maybe doing that with functions has other problems, though.

Reply to this note

Please Login to reply.

Discussion

The problem is that svelte is trying to re-invent garbage collection. It seems to me like you could just... let stuff be defined, and it would disappear when everything that holds a reference to it gets collected.