redux-saga: takeLatest in effect not working

I have a project with a previous version where i access takeLatest from ‘redux-sga’, but after update the package, i get a warning that it has been deprecated. And when i import takeLatest from ‘redux-saga/effects’ the function is not working, it is not launching the effect qhen the action is dispatched

export function* loadUser() {
  const endpoint = '/users/current';
  console.log(endpoint)
  const response = yield call(Api.request, endpoint, 'GET');
  if (!response.errors) {
    yield put(loadUserSuccess(response));
  } else {
    yield put(loadUserFail(response.message));
    yield call(logout);
  }
}
...
export function* loadUserWatcher() {
  yield* takeLatest(LOAD_USER, loadUser);
}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (7 by maintainers)

Most upvoted comments

Wasnt the deprecation warning telling that you should use yield and not yield* from now on? Cant check the source code right now, but this should be the answer for your problem On Mon, 16 Jan 2017 at 18:12, Jose Miguel Navarro notifications@github.com wrote:

I have a project with a previous version where i access takeLatest from ‘redux-sga’, but after update the package, i get a warning that it has been deprecated. And when i import takeLatest from ‘redux-saga/effects’ the function is not working, it is not launching the effect qhen the action is dispatched

export function* loadUser() { const endpoint = ‘/users/current’; console.log(endpoint) const response = yield call(Api.request, endpoint, ‘GET’); if (!response.errors) { yield put(loadUserSuccess(response)); } else { yield put(loadUserFail(response.message)); yield call(logout); } } … export function* loadUserWatcher() { yield* takeLatest(LOAD_USER, loadUser); }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/redux-saga/redux-saga/issues/769, or mute the thread https://github.com/notifications/unsubscribe-auth/AJWMkmsMbn6jftF-hBqLSqMfLwARTPvPks5rS6TogaJpZM4Lkyvn .