-
-
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
Svelte 5 : Reactive doesn't work if class instance is declared in .svelte.js
#9541
Comments
Seems like a duplicate of #9301 Signals created outside of a component context use referential equality by default |
Oh! I think I need to read latest discord chat. |
yeah, it's duplicate, just creating the state is wrapped into a class, but the bug's reason is the same. |
@benmccann it should be a duplicate for #9301 instead of part of 5.0 milestone. |
Fundamentally yes, but we need to add both tests when we fix these issue. So we can keep to open both. |
@baseballyama in that case, we should add #9301 to the milestone as well. |
Describe the bug
Creating a class containing
$state
in a.slvete.js
file and instantiating it in the same file will not be reactive.Reactive works if we create an instance in a
.svelte
file.Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE51TwW6cMBD9lYm7EiBtQbn0sAtIPfQL2luIFAeGxF2wkT2QrBD_XhvDLsoml57QeN7Mm3nzGFktGjTs8DAyyVtkB_az69ie0blzgRmwIbSxUb0u3UtqSi06ygtZkGg7pQlGIFUpAxPUWrUQxImLY18bHC3SYndY11hSGEaQ5TC6p4JKJY1qMG7USxh4QLD33eKBNz1Grpom90mTK7NMKzGAoXODWcFarl-E_P6siFR7gPsf3XvB5gFTIbuePJeSJzxX6k1mY4gDStoOYnepwT_HFgZ3WQbBL0mogwg0Uq_lcUX68XhVLXiy9EjbeT-u9mTBWMFuvC2Ynq4lt1mwUwRLfprcN8mdEnb7WYbxG_LydSsYcDOHky9KTcdlPs4vVkAXLInn3i4iQcmyEeXJajLL4TtpbNWAoQuiKYcKGySENPE1tsOYOF7LYZ3RqkrUAit2IG332V-MtDHB1VB_zdZM-D4bqGy4MfDH4v091t13hjhhKPENfiOFD4FreR88RtFiKncE4uYUrXekV7EIEV9yx48p2_kaHD9x4nyuO-fEC2wxoqdd9fmC2ev1v-S--Vf08wSrbLaMln8vA6eSkzB02Nu7PE7_APop0BPsAwAA
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: