ng-turkey / ngxs-reset-plugin

Reset plugin for NGXS: Effortlessly clears, resets, or overwrites NGXS states respecting the state tree.
https://stackblitz.com/edit/ngxs-pizza
MIT License
108 stars 8 forks source link

NgxsOnInit does not working after resetting state #84

Closed kyao-Frndz closed 1 year ago

kyao-Frndz commented 1 year ago

Hello Team,

After resetting the ngxs store with StateResetAll, the NgxsOnInit for feature Module states does not work anymore. Any assistance in resolving this will be greatly appreciated.

Thanks.

armanozak commented 1 year ago

Hi.

I may have misunderstood the question, but if you expect ngxsOnInit lifecycle hook to run again, it won't. This is because when you reset the states, they are set back to their initial value, but not re-initialized. You can see that behavior in this playground. Try ordering a new pizza. All states will be reset, but the init hook will not be called again.

Does that answer your question?

armanozak commented 1 year ago

Closing due to inactivity.