rt2zz / redux-action-buffer

Buffer Redux Actions
MIT License
79 stars 6 forks source link

Buffer not working #7

Closed damianobarbati closed 7 years ago

damianobarbati commented 7 years ago

@rt2zz is the following correct? Because I still get the following by redux persist when the only action fired is the classic redux @@INIT!

 redux-persist/autoRehydrate: 1 actions were fired before rehydration completed. This can be a symptom of a race
      condition where the rehydrate action may overwrite the previously affected state. Consider running these actions
      after rehydration:

autoRehydrate.js:65 redux-persist/autoRehydrate: sub state for key `auth` modified, skipping autoRehydrate.
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
import { routerMiddleware, routerReducer } from 'react-router-redux';
import thunkMiddleware from 'redux-thunk';
import promiseMiddleware from 'redux-promise';
import createLogger from 'redux-logger';
import { browserHistory } from 'react-router';

import { REHYDRATE } from 'redux-persist/constants'
import { persistStore, autoRehydrate } from 'redux-persist';
import createActionBuffer from 'redux-action-buffer';
import crosstabSync from 'redux-persist-crosstab';

import authReducer from './auth.reducer.js';

const reducers = {
    routing: routerReducer,
    auth: authReducer,
};
const finalReducer = combineReducers(reducers);

const loggerMiddleware = createLogger();
const finalMiddleware = applyMiddleware(
    routerMiddleware(browserHistory),
    thunkMiddleware,
    promiseMiddleware,
    createActionBuffer(REHYDRATE),
    loggerMiddleware,
);

const store = createStore(finalReducer, {}, composeWithDevTools(
    finalMiddleware,
    autoRehydrate({ log: true }),
));

export default store;
zalmoxisus commented 7 years ago

Does this still happen if you disable Redux DevTools extension? I guess the @@INIT comes from redux-devtools-instrument.

rt2zz commented 7 years ago

I believe that is actually a mistake in the autoRehydrate warning. The first action is expected to be an init action, and should not warn. Can you open an issue in redux-persist?

Your set up here looks correct 👍