spierala/mini-rx-store

With SignalStore what 's the best way to get the raw state

marcpearson opened this issue · 2 comments

When using some class store's functions (class implement FeatureStore), i need to get the RAW state from the signal FeatureStore. My implemented FeatureStore is injected in Angular constructor.
I tried to used the state() (this.store.state().XYZ) but the function is deprecated and still not replaced
Using this.store.select() return a signal. To get the RAW state i need to write this.store.select()() and it's very ugly.

What is the best practice to obtain the raw state from the store presently ?

Hi @marcpearson

The deprecated state getter function returns a Signal... but we decided that it should return the raw state in the future (as it is the case for the original MiniRx Store).

Now I created this pull request to make the state getter to return the raw state:
#215

Because this is a breaking change we will release a version 2 of the MiniRx Signal Store.
I expect to release v2 this week.

Till then this.select()() is the best way to retrieve the raw state. Admittedly that is quite ugly. But the fix is underway.

Hey @marcpearson

we just released v2 of @mini-rx/signal-store: https://www.npmjs.com/package/@mini-rx/signal-store
the state getter function returns now the raw state.