Miroslav Šerý
thes01.bsky.social
Miroslav Šerý
@thes01.bsky.social
keen programmer, musician, based in Brno, CZ
This is really nice, we had a custom `Derived` helper class to wrap the $derived rune. I actually had to construct the class "the old way" using function/prototype to get it working.
May 20, 2025 at 9:11 AM
See here svelte.dev/playground/0...

I managed to get a possible solution already though. I created a custom function that has derived inside its closure and returns

get current {
return derived_state;
}

Unsure it's ideal performance-wide though..
Untitled • Playground • Svelte
Web development for the rest of us
svelte.dev
January 9, 2025 at 8:36 PM
@matsimon.dev‬ I use the object wrapping to allow dereferencing without loosing reactivity. Like:

const { my_state } = use_context();
my_state.current = 1;

However, trying to do that with a $derived exported using a getter breaks the reactivity. Is there any way how to box the $deriveds?
January 9, 2025 at 1:07 PM