You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have implemented my own store with a proxy implementation, so that i don't have to call store.set(...) or store.update(...).
This works perfectly fine if the store is used in a component without Auto-Subscription of the store. But as soon as the store is used in a component which Auto-Subscribes the store, the app crashes and doesn't even show the page. Just a console error Cannot read property 'foo' of undefined. Even though the implementation is exactly the same.
First click on the button Change Foo in Test.svelte. Everything works as expected. Then try to uncomment // proxyStore.foo = "Bar"; in App.svelte and you will see the error Cannot read property 'foo' of undefined
Expected behavior
No errors are shown and changing the property of the store should work also in the component that uses Auto-Subscription
Information about your Svelte project:
Chrome
Linux Mint
Svelte version 3.23.2
Rollup
Severity
Very annoying bug. Unexpected behavior
The text was updated successfully, but these errors were encountered:
The presence of the store.foo = 42 for some reason prevents the compiler from emitting the required component_subscribe($$self, store, $$value => $$invalidate(0, $store = $$value));, which means that the autosubscribed $store variable remains undefined. This only appears to happen if the store itself is imported, and not if it's declared and defined in this component.
Describe the bug
I have implemented my own store with a proxy implementation, so that i don't have to call
store.set(...)
orstore.update(...)
.This works perfectly fine if the store is used in a component without Auto-Subscription of the store. But as soon as the store is used in a component which Auto-Subscribes the store, the app crashes and doesn't even show the page. Just a console error
Cannot read property 'foo' of undefined
. Even though the implementation is exactly the same.To Reproduce
Repl:
https://svelte.dev/repl/c1b53139e2bb45be8eec3f23d5530770?version=3.23.2
First click on the button Change Foo in Test.svelte. Everything works as expected. Then try to uncomment
// proxyStore.foo = "Bar";
in App.svelte and you will see the errorCannot read property 'foo' of undefined
Expected behavior
No errors are shown and changing the property of the store should work also in the component that uses Auto-Subscription
Information about your Svelte project:
Chrome
Linux Mint
Svelte version 3.23.2
Rollup
Severity
Very annoying bug. Unexpected behavior
The text was updated successfully, but these errors were encountered: