This error only occurs after clearing all cache. The app is developed using javascript and react-native. We are using Expo with an iOS simulator, a real iPhone and an Android tablet. When the app reloads the program starts without a hitch.
This is the error from iOS
undefined is not an object(evaluating 'Object.keys(inboundState)')
Additional info listed with the message as follows
defaultStateReconciller
autoRehydrate.js:66:14
dispatch
createStore.js:178:36
This is how it manifest on Android Requested keys of a value that is not an object.
Additional info listed with the message as follows
defaultStateReconciller
dispatch
createStore.js:190:3
The yarn.lock has these lines "@redux-offline/redux-offline@^2.3.2": version "2.3.2" resolved " https://registry.yarnpkg.com/@redux-offline/redux-offline/-/redux-offline-2.3.2.tgz#ecdb324e198bd4aa6b965f651ec589f66c8f2605 " dependencies: babel-runtime "^6.26.0" redux-persist "^4.5.0"
redux-persist@^4.5.0: version "4.10.2" resolved " https://registry.yarnpkg.com/redux-persist/-/redux-persist-4.10.2.tgz#8efdb16cfe882c521a78a6d0bfdfef2437f49f96 " dependencies: json-stringify-safe "^5.0.1" lodash "^4.17.4" lodash-es "^4.17.4"
redux-persist@^5.9.1: version "5.9.1" resolved " 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> )
There is an issue posted on gihub regarding this https://github.com/redux-offline/redux-offline/issues/362#issuecomment-552190934
Try this workaround,
//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
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.