rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.93k stars 866 forks source link

Error: No such file '/files/persistStore/root' #1009

Open cokealmonacid opened 5 years ago

cokealmonacid commented 5 years ago

Im getting the following error when launch the app on android emulator and devices, on iOS emulator works fine:

Captura de pantalla 2019-03-18 a la(s) 21 48 41

action {type: "persist/REHYDRATE", payload: undefined, err: Error: No such file '/data/user/0/com.findmebikegps/files/persistStore/root'; /data/user/0/com.find…, key: "root"}

Actually im using for the storage redux-persist-filesystem-storage, if change it and use the exact same example of this repo have the following error:

Captura de pantalla 2019-03-18 a la(s) 21 58 34

action {type: "persist/REHYDRATE", payload: undefined, err: undefined, key: "root"}

This is the App.js file:

import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
/* Redux configuration */
import { applyMiddleware, compose, createStore } from 'redux';
import { persistStore, persistReducer } from 'redux-persist';
import FilesystemStorage from 'redux-persist-filesystem-storage';
import { PersistGate } from 'redux-persist/integration/react';
import { Provider } from 'react-redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk';
import reducers from './src/reducers';
/* App Configuration */
import { name as appName } from './app.json';
import App from './src/App';

const persistedReducer = persistReducer({
  key: 'root', keyPrefix: '', storage: FilesystemStorage,
}, reducers);

function configureStore(initialState) {
  const enhancer = compose(
    applyMiddleware(thunk, logger),
  );
  return createStore(persistedReducer, initialState, enhancer);
}

const initialState = {};
export const store = configureStore(initialState);
export const persistor = persistStore(store);

class App extends Component {
  render() {
    return (
      <Provider store={store}>
        <PersistGate loading={null} persistor={persistor}>
          <App />
        </PersistGate>
      </Provider>
    );
  }
}

Dependencies versions:

    "react": "16.6.3",
    "react-native": "0.58.3",
    "react-redux": "^6.0.0",
    "redux": "^4.0.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.10.0",
    "redux-persist-filesystem-storage": "^1.3.2",
andrewzey commented 3 years ago

https://github.com/robwalkerco/redux-persist-filesystem-storage/issues/47 and https://github.com/robwalkerco/redux-persist-filesystem-storage/pull/33/files are related