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
It is a common pattern to put stores into context for reactivity, even the docs recommend it, however there is one mildly annoying thing when you want to use that store within the same component. See the examples below (imports removed for brevity):
This one sparks joy (not possible currently)
<script>
constmy_store_thing=setContext(key, writable());
</script>
Do stuff with {$my_store_thing} in the same component.
This one does not
<script>
constmy_store_thing=writable();setContext(key, my_store_thing); // my_store_thing is repeated here.
</script>
Do stuff with {$my_store_thing} in the same component.
Describe the proposed solution
Make setContext return the value that was passed into it as the second argument. Should be a non breaking change AFAIK unless people are doing weird things with it.
Alternatives considered
Leave things as is.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered:
Describe the problem
It is a common pattern to put stores into context for reactivity, even the docs recommend it, however there is one mildly annoying thing when you want to use that store within the same component. See the examples below (imports removed for brevity):
This one sparks joy (not possible currently)
This one does not
Describe the proposed solution
Make setContext return the value that was passed into it as the second argument. Should be a non breaking change AFAIK unless people are doing weird things with it.
Alternatives considered
Leave things as is.
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: