Strange behavior when passing action function into store.dispatch #1906
Labels
Accepting PRs
community watch
Someone from the community is working this issue/PR
enhancement
Project: Effects
Project: Store
Projects
Minimal reproduction of the bug/regression with instructions:
I called someAction (see below simple example code) without function call "()" when it passed to store.dipatch(....)! The problem, it has not become an error. The action even arrived the reducer. Unfortunately it was not logged in the ReduxDevTools (it freezed, all other actions e.g. router will be ignored in the ReduxDevTools). Only with a MetaReducer logger I see what happens. After I called closeMainSidebarAction() with "()" the ReduxDevTools worked again.
We should prevent this behavior by throwing an error.
That was really frustrating! I think it took me more than 2 hours to realize that I forgot to call the function call. I think that the potential is high that another one will run into this strange behavior.
I will create a PR for it!
Code Example:
Expected behavior:
It should throw an error that to pass a function into dispatch is not allwed?
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
ngrx v8 rc0
Other information:
I would be willing to submit a PR to fix this issue
[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
The text was updated successfully, but these errors were encountered: