第二次派发时的相同动作不会调用 saga,而在第一次派发时会正确执行

the same action when dispatched for the second time does not call the saga, while it does correctly in the first tie

当 saga 在第一次加载后的某个动作上被调用时,它工作正常。 但是当相同的动作在 saga 上执行两次时,动作被调度但 saga 从未收到它。

useEffect(() => {
  if (show) {
   updateTitle(message.title);
   if (!status || status === Status.Initiate) {
    createStatus();
   }
  }
  return () => {
   if (!show) {
    cleanup();
   }
  };

 }, [status]);

以下过程解决了我的问题。

事实证明,在运行时,如果某些 saga 无法执行,则永远不会再次调用该 saga,这意味着如果为该 saga 生成任何操作,它就会被忽略。

要检查 saga 是否在运行时失败,您可以将 saga 的主体包装在 try catch 块中。

function* failingSaga() {
  try {
  
    // saga-body
  } catch(e) {
    console.log(e);
  }
}

这将有助于了解异常是什么。