redux-saga: [bug] Forking an effect creator causes it to run
Reproduced issue: https://codesandbox.io/s/68rm79Qg7
yield fork(call, fn)
its ok, as call is just a function so it shouldnt be treated any different
yield fork(() => call(fn))
its not ok, fn gets executed, returned effect is interpreted, it should not happen, may lead to unexpected behaviours
yield fork(takeEvery, ‘pattern’, fn)
its not ok, takeEvery uses fork under the hood, and it seems that nested fork(fork, fn, ...) gets ‘unwrapped’ and unwrapped task descriptor (one for takeEvery('pattern', fn) / fork(fn, ...)) gets returned to the caller saga.
Probably similar thing happens when returning iterators - need to be checked.
Returning promises / iterators from call is working, but should be treated as special cases.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (15 by maintainers)
Don’t ever be afraid of contributing back to OSS. Most of the project maintainers are really helpful in reviewing and explaining the internals.