【发布时间】:2022-08-11 16:22:23
【问题描述】:
我在 Store 的 react-native 上使用 easy-peasy v5,每次尝试在 thunk 中调用操作时都会引发错误。
fetch: thunk(async (actions, teamId, { getStoreActions }) => {
// get data of all items
/* ... */
try {
getStoreActions().account.users.fetched(...);
} catch (e) {
console.log(\"Store Error (teams/fetch) 93 \", e);
}
try {
actions.fetchedMembers(...);
} catch (e) {
console.log(\"Store Error (teams/fetch) 101 \", e);
}
// get teams by id, and the ids
/* ... */
// update store data
try {
actions.fetched(...);
} catch (e) {
console.log(\"Store Error (teams/fetch) 114 \", e);
}
return data;
}),
此 thunk 调用输出:
Store Error (teams/fetch) 93 [TypeError: Proxy has already been revoked. No more operations are allowed to be performed on it]
Store Error (teams/fetch) 101 [TypeError: Proxy has already been revoked. No more operations are allowed to be performed on it]
Store Error (teams/fetch) 114 [TypeError: Proxy has already been revoked. No more operations are allowed to be performed on it]
该问题不是第一次出现(清除所有缓存和存储后),而是在每次连续启动时出现。
我在带有 AsyncStorage 的 react-native 上使用 easy-peasy 的 persist 函数。
如果没有persist,错误的数量会减少。
我必须启用其他设置才能使持久性正常工作:
- setAutoFreeze: 假
- window.requestIdleCallback:空
标签: reactjs react-native redux react-redux easy-peasy