Is there a standard way to break while true loops with call effect when END is dispatched?
Author: krutooCreated Sep 20, 2023Updated Oct 13, 2023
Hi, first of all thanks for great library.
In my case i have many while true loops and i want to break them all when end is dispatched.
Unfortunately, this loops dont breaks when END is dispatched.
There is the example:
function* main () {
yield fork(infiniteUpdate);
}
function* infiniteUpdate () {
while (true) {
yield call(delay, 1000);
yield call(update);
}
}
function delay (ms) {
return new Promise(done => setTimeout(done, ms))
}
function update () {
console.log('update called');
}
when i call sagaMiddleware.run(main) it start log every second.
after I dispatch the END it still continues to logs.
Is there a standard way to break while true loops with call effect where END is dispatched?
Source: redux-saga/redux-saga