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

Waiting for an action with takeMaybe / take after END is dispatched for SSR #534

Open
sandeepahuja-stack opened this issue Mar 16, 2023 · 0 comments

Comments

@sandeepahuja-stack
Copy link

Waiting for an action with takeMaybe / take after END is dispatched for SSR

function actionStateUpdate(data){
  return {
   type : 'STATE_UPDATE',
   payload: data
  }
}
function *abc(action){
  const response = yield call(api);
  yield put(actionStateUpdate, response);
  // state is getting updated 
  const state = yield select();
}

function *xyz(action){
  // used both take/takeMaybe
  const wantsToUseActionPayload = yield takeMaybe('STATE_UPDATE');
  console.log("here", wantsToUseActionPayload)
  //in case of take, console is not getting printed
  // in case of takeMayBe  getting => { type: '@@redux-saga/CHANNEL_END' }

  const state = yield select();
  // unable to found updated state 
}

Using Next Js and next redux wrapper
in Get server side props,

store.dispatch(END as any) 
await store.sagaTask.toPromise()
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

1 participant