takeEvery() and takeLatest() are already implemented, whereas takeFirst() is not.
fork(function* () {
while (true) {
const action = yield take(ACTION_TYPE)
yield call(doSomethingAsync, action)
}
})
I want to simplify it into:
(The signature concept is the same as takeEvery() or takeLatest())
takeFirst(ACTION_TYPE, function* (action) {
yield call(doSomethingAsync, action)
})
I prefer builtin takeFirst() API to third-party ones.
However, I also think it should be limited by user interface disabling rather than saga.
<button disabled={state.pending}>Submit</button>
We also need the takeFirst effect. Adding the logic on the component may be a good idea in some cases, yet it adds some complexity on components, which can be easily removed using this new effect.
@jpetitcolas
Its easily implemented on the user-side with implementation provided by @mpyw . I would suggest creating ur own set of saga helpers anyway, so you can add it to those and import them just like effects - just from the other module.
There are no plans at the moment to expand on the built-in 'helpers', as the focus is on something else and the time is rly limited. That being said - I would love to create more robust helpers library in the future.
Most helpful comment
@jpetitcolas
Its easily implemented on the user-side with implementation provided by @mpyw . I would suggest creating ur own set of saga helpers anyway, so you can add it to those and import them just like effects - just from the other module.
There are no plans at the moment to expand on the built-in 'helpers', as the focus is on something else and the time is rly limited. That being said - I would love to create more robust helpers library in the future.