後、私はリフレッシュ間Reduxの状態ツリーを永続化するためにredux-storage
を使用して、ストレージエンジンなどなどが、Reduxのストレージ負荷
redux-storage-engine-localstorage
。
私の問題は
1)この状態を持続ロードアクション、および
2)私はcomponentDidMount
ライフサイクル機能でオフに設定され、いくつかの他のアクションの順序に関係しています。
の後にのアクションが発生したため、古い状態が上書きされるため、トリガーするアクションも発生していない可能性があります。
ページのロード時に、私の減速の上部のアクションタイプをプリントアウト私は、次を参照してください。
action.type @@redux/INIT
action.type HIDE_MODAL
action.type REDUX_STORAGE_LOAD
action.type REDUX_STORAGE_SAVE
action.type FETCH_USER_FAILURE
action.type REDUX_STORAGE_SAVE
HIDE_MODAL
アクションが私のコンポーネントのcomponentDidMount
方法の一つにトリガされます。
(右私のReduxのストアを作成した後):
import mainReducer from './reducers';
const reducer = storage.reducer(mainReducer);
const storageEngine = createEngine(some key);
const storageMiddleware = storage.createMiddleware(storageEngine);
const middleware = applyMiddleware(
storageMiddleware,
);
const storageLoad = storage.createLoader(storageEngine);
const store = createStore(
reducer,
middleware,
);
storageLoad(store);
render(
<Provider store={store}>
...
</Provider>,
document.getElementById('root')
);
はなぜREDUX_STORAGE_LOAD
は、他のすべての前に発生しません、それは前に発生したことを確認する方法がありますほかのすべて?