incepter / react-async-states

A Multi-Paradigm React State Management Library
https://incepter.github.io/react-async-states/
MIT License
115 stars 11 forks source link

Transcient configuration #139

Open incepter opened 1 year ago

incepter commented 1 year ago

Allow removing async states after all subscribers unsubscribe

Actual behavior:

Actually no instance gets removed from the pool once it's created;

Expected behavior:

To be able to declare instances that they will get immediately removed after being released, such when using them inside react components, I should be able to tune whether the state stays after my components unmounts, or to stay there for future usage. Actually, this is done via resetStateOnDispose, but it only resets the actual state, it does not remove the instance.

incepter commented 10 months ago

Anonymous instances get removed automatically, another flag will be used to detach it from the context when all subscribers unsubscribe