Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't work watchers after yield takeEvery #403

Open
ilchenkoArtem opened this issue Jan 21, 2021 · 2 comments
Open

Don't work watchers after yield takeEvery #403

ilchenkoArtem opened this issue Jan 21, 2021 · 2 comments

Comments

@ilchenkoArtem
Copy link

Hello!

I have watchers function

import {takeEvery,takeLatest} from 'typed-redux-saga'

export function* watchSmsTemplatesSagas() {
  yield takeEvery(smsTemplatesActions.startInit.type, handlerInit);
  yield takeLatest(smsTemplatesActions.delete.type, handlerDeleteSmsTemplate);
  yield takeLatest(smsTemplatesActions.submitForm.type, handlerFormSubmit);
  yield takeLatest(smsTemplatesActions.changeValidSymbols.type, handlerChangeValidSymbols);
}

All the effects which was written after the takeEvery don't work.

But!

  1. If I use only takeEvery from @redux-saga/core/effects all work good
import {takeLatest} from 'typed-redux-saga';
import {takeEvery} from '@redux-saga/core/effects';

export function* watchSmsTemplatesSagas() {
  yield takeEvery(smsTemplatesActions.startInit.type, handlerInit);
  yield takeLatest(smsTemplatesActions.delete.type, handlerDeleteSmsTemplate);
  yield takeLatest(smsTemplatesActions.submitForm.type, handlerFormSubmit);
  yield takeLatest(smsTemplatesActions.changeValidSymbols.type, handlerChangeValidSymbols);
}
  1. if I use all effects from typed-redux-saga with * all work good too
import {takeLatest, takeEvery} from 'typed-redux-saga';

export function* watchSmsTemplatesSagas() {
  yield* takeEvery(smsTemplatesActions.startInit.type, handlerInit);
  yield* takeLatest(smsTemplatesActions.delete.type, handlerDeleteSmsTemplate);
  yield* takeLatest(smsTemplatesActions.submitForm.type, handlerFormSubmit);
  yield* takeLatest(smsTemplatesActions.changeValidSymbols.type, handlerChangeValidSymbols);
}
@ThomasStock
Copy link

Same issue here

@wbobeirne
Copy link

You can avoid this with the Babel macro, since it will use the redux-saga/effects effects instead: https://github.com/agiledigital/typed-redux-saga#babel-macro.

I dug into the code a bit to see why this might be, but I don't understand exactly how generators work well enough to understand this. But it likely has something to do with the function being wrapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants