Open aminpaks opened 6 years ago
Hrmm, this could be kind of interesting - but wondering if a middleware would be better suited - as results of dspatch will go through all middleware.
That said, I do like the idea - I'll think on this a bit more.
I'll let you decide. I'll be glad to work on a prototype.
@aminpaks If you want to work on a prototype, happy to review the PR.
Some other questions/thoughts I'd have though is:
to answer to your questions:
takeUntil
or simply an unsubscription callIf this is clear I can work on a prototype.
This is a...
[x] feature request
What toolchain are you using for transpilation/bundling?
[x]
@angular/cli
Environment
NodeJS Version: 8.7.0 Typescript Version: 2.3.4 Angular Version: 4.3.x @angular-redux/store version: 6.5.7 @angular/cli version: (if applicable) OS: macOS
Expected Behaviour:
The
dispatch
decorator should accept more than just a simple object. Sometimes it would be very useful to return a promise or even better observable in the method of component. Ifdispatch
could accept this behaviour and after receiving the first value dispatch it to store would remove lots of boilerplate.Example of use-case:
Actual Behaviour:
The
dispatch
decorator only accepts the method to return a plain object.Additional Notes:
If you are on board with the idea I can work on it and create a PR.