store
store copied to clipboard
Action Handler Decorator
I have code like this:
this._actions
.pipe(ofActionDispatched(SelectFolderSuccess), takeUntil(this._destroy$))
.subscribe(({ payload }) => this.onSelectFolderSuccess(payload));
I want to have code like this instead:
@ActionHandler(SelectFolderSuccess)
onSelectFolderSuccess(payload) { ... }
2 Challenges:
- Need a way to bind the fn to the appropriate context once the action is invoked
- Need a way to unsubscribe on destroy
Reference: https://github.com/angular/angular/issues/23038#issuecomment-381670075
Closing and marking for future.
Any update on this? 🙁 It's kind of annoying to have to write unsubscribe boilerplate for every action handler.
any update?