Race condition in 0.10.x
See original GitHub issueI’ve just upgraded to 0.10.4 and also tried this in 0.10.0.
I’m now finding that take
has become a little deaf during page load.
I have the following Saga that work fine in 0.9.5, that I’ve added some logging to.
export function* loadSearchResultsSaga(action) {
console.log('Put SEARCH_RESULTS_REQUESTED');
yield put(searchResultsActions.loadSearchResults(action));
console.log('Take SEARCH_RESULTS_SUCCESS');
yield take([
searchResultsTypes.SEARCH_RESULTS_SUCCESS,
searchResultsTypes.SEARCH_RESULTS_FAILURE,
]);
console.log('Put LOADING FINNISH');
yield put(appStateActions.loadingFinish());
}
However in 0.10.x it gets stuck at the take
.
To dig into this a bit further I’ve added the following Saga to log out all the redux actions.
function* log() {
yield* takeEvery('*', function* (action) {
console.log('Action:', action.type);
});
}
This leads to the following output in the console.
searchResultsSagas.js:118 Action: SET_SEARCH_RESULTS_TRACKING_FLAG
searchResultsSagas.js:28 Put SEARCH_RESULTS_REQUESTED
searchResultsSagas.js:118 Action: SEARCH_RESULTS_REQUEST
searchResultsSagas.js:118 Action: LOCATION_UPDATED
searchResultsSagas.js:118 Action: HASH_UPDATED
client.js:55 [HMR] connected
searchResultsSagas.js:118 Action: SEARCH_RESULTS_SUCCESS
searchResultsSagas.js:35 Take SEARCH_RESULTS_SUCCESS
So it would seem that the Redux action is firing before the take
has an opportunity to run. I’m guessing this is caused by a delay in the response to yield put
on the previous line.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
What is a Race Condition? - TechTarget
A race condition is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the...
Read more >Study of Race Condition: A Privilege Escalation Vulnerability
The Race condition is a privilege escalation vulnerability that manipulates the time between imposing a security control and.
Read more >Study of Race Condition: A Privilege Escalation Vulnerability
A race condition occurs in a shared memory program when two threads access the same variable using shared memory data, and at least...
Read more >[Bug 683842] New: Fix race condition in videomixer2 on 0.10
x Summary: Fix race condition in videomixer2 on 0.10 Classification: Platform Product: GStreamer Version: 0.10.x OS/Version: Linux Status: UNCONFIRMED Severity: ...
Read more >Race condition in ActionController::Serialization ... - GitHub
Race condition in ... joaomdmoura added V: 0.10.x C: Good for New Contributors labels on Jun 25, 2015. @joaomdmoura joaomdmoura added this to...
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
https://github.com/yelouafi/redux-saga/releases/tag/v0.10.5
nit: this would have perhaps been better behind a minor version bump given that this breaks code that relies on the 0.10.0-0.10.4 behavior