I am trying since weeks to understand why my yield cancel
throw an error when I am trying to run a cancel
effect in my root saga :
export function* loginData() {
const watcher = yield fork(getLoginWatcher);
yield take(LOCATION_CHANGE);
yield cancel(watcher);
}
Error in console:
utils.js:202 uncaught at getLogin Generator is already running"
If I remove the cancel my saga doesn't get canceled. It's like working and throwing error at the same time.
Having this error really annoy me it look like there is a problem with my application.
The execution env :
Does anyone has any information on how redux-saga/effects
proc does handle it's cancel
effect and how the is already running error is generated.
I think the cause of this might not have been the cancel effect, as stated in the description. I was trying to complete a similar login process independently, using react-boilerplate, and finding a lot of the other examples were using older methods than the latest boilerplate code, so have been working through the issues and I also got this exact error, which from the call stack appeared to be coming from the cancel effect. However, when reading through the same issue as posted here https://github.com/react-boilerplate/react-boilerplate/issues/1281 somebody suggested that it was in fact an error being caused because 'forwardTo' was being called without using
yield call (forwardTo, params)
Once I changed calls in the sagas to this, the error went away. I assume this is the solution to the problem. Others seem to agree on the github issue page.