-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Svelte 5: $state.link
various bugs
#12936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I started exploring this a bit...it feels a bit weird to me that we are calling the callback when svelte/packages/svelte/src/internal/client/reactivity/sources.js Lines 72 to 95 in 363a541
shouldn't the callback be called when we set the value (and when the original value is set)? The two times the callback is called is once in the |
Hmm. Yeah I had the same reaction to the placement of the callback but didn't interrogate it — seems our test coverage is insufficient. Looking into it. Yes, whenever initialising or reassigning a binding with a value that could be proxifiable, we wrap it in |
It seems like moving that logic inside the derived instead then on read kinda fixes it but it introduce a couple of very big problems:
|
We just shouldn't be using a derived at all here, as far as I can tell. PR incoming |
|
Describe the bug
I was playing around with
$state.link
to familiarise a bit with it and i think i've encountered 3 weirds behaviours that could be bugs.The code is relatively simple
Weird things:
which sounds weird because the value is always proxified? I guess it's just impossible to check if it's a source or a proxy so we go with proxy?
Reproduction
REPL
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: