此错误仅在清除所有缓存后发生。该应用程序是使用javascript和react-native开发的。我们使用的世博会有一个iOS模拟器,一个真正的iPhone和一个安卓平板电脑。当应用程序重新加载时,程序启动时没有任何故障。
这是来自iOS的错误
undefined is not an object(evaluating 'Object.keys(inboundState)')消息中列出的其他信息如下
defaultStateReconciller
autoRehydrate.js:66:14
dispatch
createStore.js:178:36这就是它在Android请求的值不是对象的键上的表现方式。
消息中列出的其他信息如下
defaultStateReconciller
dispatch
createStore.js:190:3yarn.lock包含以下行"@redux-offline/redux-offline@^2.3.2":版本"2.3.2“解决了"https://registry.yarnpkg.com/@redux-offline/redux-offline/-/redux-offline-2.3.2.tgz#ecdb324e198bd4aa6b965f651ec589f66c8f2605”依赖关系:babel-运行时"^6.26.0“redux-persist "^4.5.0”
redux-persist@^4.5.0:版本"4.10.2“解决了"https://registry.yarnpkg.com/redux-persist/-/redux-persist-4.10.2.tgz#8efdb16cfe882c521a78a6d0bfdfef2437f49f96”依赖关系: json-stringify-safe "^5.0.1“lodash "^4.17.4”lodash-es "^4.17.4“
redux-persist@^5.9.1:版本"5.9.1“已解析"https://registry.yarnpkg.com/redux-persist/-/redux-persist-5.9.1.tgz#83bd4abd526ef768f63fceee338fa9d8ed6552d6”
App.js
import { createStore, combineReducers, compose } from 'redux'
import { offline } from '@redux-offline/redux-offline'
import offlineConfig from '@redux-offline/redux-offline/lib/defaults'
import storage from 'redux-persist/lib/storage'
import { persistStore, persistReducer } from 'redux-persist'
const persistConfig = {
key: 'root',
storage
}
const persistedReducer = persistReducer(persistConfig, appReducer)
offlineConfig.effect = (effect, action) => {
return fetchApi(effect.endpoint, effect.payload ? effect.payload : null,
effect.method ? effect.method : null, effect.headers ? effect.headers : null)
}
export const store = createStore(
persistedReducer,
[],
compose(
offline(offlineConfig)
)
)
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<Initialize />
<Root>
<RootStack />
</Root>
</PersistGate>
</Provider>
)
发布于 2020-01-07 15:13:53
在gihub上发布了一个关于此https://github.com/redux-offline/redux-offline/issues/362#issuecomment-552190934的问题
尝试此解决方法,
//redux-offline/node_modules/lib/autRehydrate.js:62
function defaultStateReconciler(state, inboundState, reducedState, log) {
var newState = _extends({}, reducedState);
if (typeof inboundState !== 'object') return newState; // add this line.
//...rest
}https://stackoverflow.com/questions/50301517
复制相似问题