I'm trying to reset my state, but I can't. I could use 'this.store.reset(State)', but sometimes I want to wait in somewhere by the action dispatched. And sometimes I want to reset everything except by one attribute. If the state has too many attributes it's easier create a function to assign each attribute to its default.
But the easiest would be just "return defaults", or "return { ...defaults, attribute: draft.attribute } as StateModel"
I'm trying to reset my state, but I can't. I could use 'this.store.reset(State)', but sometimes I want to wait in somewhere by the action dispatched. And sometimes I want to reset everything except by one attribute. If the state has too many attributes it's easier create a function to assign each attribute to its default.
But the easiest would be just "return defaults", or "return { ...defaults, attribute: draft.attribute } as StateModel"
Here is the stackblitz exemple: https://stackblitz.com/edit/angular-c2nszw