-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Properties are not reactive when using mount
and $state
props.
#12904
Comments
Should |
This does not fix it sadly: https://github.com/Hugos68/svelte-5-main--effect.root-not-working |
Bindable works by checking if the object property is an accessor with a setter. In this case, it is not. If you make it so this is the case: mount(Component, {target: document.body, props: {
get count() {
return props.count;
},
set count(v) {
props.count = v;
}
}}); Then you have two-way bindings working outside. |
I thought this is what proxied $state already did for you? (Assuming |
This is about props, not state. So no, it doesn't do this for you. |
Thanks for the easy solution. I will mark this as closed |
Describe the bug
When creating a component in a .svelte.js using
mount
, and defining it's properties as a$state
, a change in the property inside the component won't trigger effects defined in the module file.Reproduction
Logs
No response
System Info
System: OS: macOS 14.3 CPU: (8) arm64 Apple M1 Pro Memory: 61.89 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 21.2.0 - /usr/local/bin/node npm: 10.2.3 - /usr/local/bin/npm Browsers: Chrome: 127.0.6533.120 Safari: 17.3 npmPackages: svelte: ^5.0.0-next.225 => 5.0.0-next.225
Severity
annoyance
The text was updated successfully, but these errors were encountered: