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
if you replace the store passed in $text (eg. <Component $text={store} />) the store isn't actually replaced.
To solve this issue on my personal usage, I wrap the nanostore in a getter function and use createRenderEffect,
my fix may have problems I am not sure.
exportfunctionuseStore<SomeStoreextendsStore,ValueextendsStoreValue<SomeStore>>(store: SomeStore|(()=>SomeStore)): Accessor<Value>{// if it's a function we do my implementationif(typeofstore=="function"){const[state,setState]=createSignal(store().value);createRenderEffect(()=>{constunsub=store().subscribe((val)=>{setState(val);});onCleanup(unsub);});returnstate;}// Activate the store explicitly:// https://github.com/nanostores/solid/issues/19constunbindActivation=store.listen(()=>{});const[state,setState]=createStore({value: store.get(),});constunsubscribe=store.subscribe((newValue)=>{setState("value",reconcile(newValue));});onCleanup(()=>unsubscribe());// Remove temporary listener now that there is already a proper subscriber.unbindActivation();return()=>state.value;}
The text was updated successfully, but these errors were encountered:
useStore hook doesn't seem to handle component props as it should?
if you replace the store passed in
$text
(eg.<Component $text={store} />
) the store isn't actually replaced.To solve this issue on my personal usage, I wrap the nanostore in a getter function and use createRenderEffect,
my fix may have problems I am not sure.
The text was updated successfully, but these errors were encountered: