Open TobbiAR opened 1 year ago
I checked a code. There's a bug when we return an action to dispatch in effect. You're welcome to make a pr. We need to change a little subscribeEffect
and check for customActionsStream
not only in effect.sourceFn
but also while dispatching in the subscribe
.
@TobbiAR please update to the latest version. I made a little fix so it should work fine now.
I'll test this feature as soon I'm able to migrate my project to angular v16. Thank you!
Which @ngneat/effects-* package(s) are the source of the bug?
effects-ng
Is this a regression?
No
Description
During writing jest tests for effects I've encountered the problem, that actions, which are dispatched by effects are not getting emitted inside
customActionsStream
. During runtime and regular use (withoutcustomActionsStream
), this problem does not exist.The simple test example below illustrates the problem:
loadTodos
gets dispached and dispatches after completionloadTodos2
. The test fails, becauseloadTodos2
never apprears insidecustomActionsStream$
.How I've encountered this problem? / Use Case I want to test effects, which are performing store updates. To ensure, that the update process triggered by the effect is properly performed, the effect dispatches a "completion" action. When the completion action is dispatched, I'm able to verify, that the performed state mutations/ async side-effects are properly done.
Reproduction example:
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
Anything else?
No response
Do you want to create a pull request?
No