race effect without automatic cancellation ?
See original GitHub issueHi,
I have this use case where I want to hava a race but avoid automatic cancellation :
export function* mySaga() {
const task = yield fork(myApiCallSaga)
let { timeout, result } = yield race({
timeout: delay(500),
result: task.done
})
if (timeout) {
yield put({ type: 'display-something' })
result = yield join(task)
}
return result
}
Basically here, I trigger an Api call in a forked saga, and if the forked task lasts more than 500ms, I display something (trigger a put), and join the forked tasked to get the result.
The problem here is that the race effect cancels myApiCall if the timeout expires.
May be there’s another way of doing this.
Thanks a lot
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Racing Effects | Redux-Saga
In the case a CANCEL_TASK action is dispatched, the race Effect will automatically cancel backgroundTask by throwing a cancellation error inside it.
Read more >A Meta-Analysis of the “Erasing Race” Effect in the United ...
The “erasing race” effect is the reduction of the salience of “race” as an alliance cue when recalling coalition membership, once more accurate ......
Read more >Americans and 'Cancel Culture': Where Some See Calls for ...
“[Cancel culture] means rewriting history and stopping the acknowledgment of facts because they are offensive to a racial, religious, ...
Read more >Automation and the future of the African American workforce
Even without the effects of automation, this distribution exacerbates racial wealth inequality. For example, support roles are predicted to ...
Read more >What is a Race Condition? - TechTarget
Learn what race conditions are in computer science and programming, ... A noncritical race condition does not directly affect the end state of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve found this workaround, make the promise uncancelable :
What do you think ?
@yelouafi You mentioned here and a couple other issues that you were thinking of adding a non destructive race effect, can I ask if you tried this or have plans to implement? I have a use case for that type of effect as well.