RAM usage too high when persisting data
See original GitHub issueWe are having a difficult time with the app we are building to have offline capabilities.
The RAM usage is really high when the data is fetched and passed to the reducers (especially when it contains large JSON data), which crashes the app.
If we remove the redux-persist package, the RAM is fine but we need offline capabilities in our app that have large data transfer from API calls to mobile.
Anyone have any idea on what to do or how to flush the RAM out after each call?
“redux-persist”: “5.10.0”
Thanks.
configureStore.js
const persistConfig = {
key: "root",
storage: isApple() ? storage : FilesystemStorage,
stateReconciler: autoMergeLevel2,
};
const enhancer = compose(
applyMiddleware(thunk),
);
const pReducer = persistReducer(persistConfig, reducer);
export const store = createStore(pReducer, enhancer);
export const persistor = persistStore(store);
reducerIndex.js
const projectsPersistConfig = {
key: "projects",
storage: isApple() ? storage : FilesystemStorage,
blacklist: ["selected", "isLoading", "selectedTile"]
};
const setupPersistConfig = {
key: "setup",
storage: isApple() ? storage : FilesystemStorage,
blacklist: ["connection", "isLoading", "authFailed"]
};
const defectsPersistConfig = {
key: "defects",
storage: isApple() ? storage : FilesystemStorage,
blacklist: ["syncError", "isLoading", "selected", "showToaster"]
};
const rootReducer = combineReducers({
defects: persistReducer(defectsPersistConfig, ReducerDefects),
setup: persistReducer(setupPersistConfig, ReducerSetup),
projects: persistReducer(projectsPersistConfig, ReducerProjects),
});
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:7
Removed redux persist completely from the project and started using SQLite
react-native-sqlite-storage
.Has then been addressed at all? I’m experiencing the same issue and wonder if someone has found a fix for it.