javascript - Redux saga not working after network reconnection
问题描述
Using redux saga to handle async requests. I noticed that if the user lost its network connection and execute the action, the saga will handle it on the catch block but when after while the network reconnects, sagas stop work because the function generator don't executes anymore. And just back to work again if the user refresh the page. Thats not good for ux.
I appreciate if anybody can give me a hand.
action:
export function sendMessage(room, message) {
return {
type: 'SEND_MESSAGE',
payload: {
room,
message,
},
}}
saga:
function* sendMessage({ payload: { room, message } }) {
yield api.sendMessage(room, message);
} catch (error) {
/* code... */
}}
export default all([
takeLatest('SEND_MESSAGE', sendMessage),
]);
解决方案
推荐阅读
- javascript - 我使用一次后所有按钮都失去功能
- java - 扫描文件并将它们分配给对象数组时出现“不匹配错误”
- c++ - 从 bash 脚本(C++ 程序)将字符串推入 cin
- spring-data-jpa - 将 `@Transactional` 与 Spring 的 `@Retriable` 一起使用
- firebase - ionis 3中的Cordova插件firebase突然错误
- c# - 试图用箭头键移动 1 个对象,用 wasd 移动另一个对象
- node.js - TypeError:无法读取未定义的属性“DASH”
- java - 如何在 Spring-Mvc 中缓存具有两个参数的方法
- ruby-on-rails-5 - 如何调试ruby-on-rails mac osx的升级
- excel - 如何在我的 Excel 工作簿中替换编译为 dll 文件的 VBA 代码?