redux-state-sync icon indicating copy to clipboard operation
redux-state-sync copied to clipboard

Use with ConfigureStore()

Open seivad opened this issue 2 years ago • 2 comments

Hey guys I cannot get this to work with configureStore() which is Redux's recommended way of working with fresh applications. Can someone provide an example of getting createStateSyncMiddleware() into the configureStore() middleware array?

If I enable it, my ID's and Entities are nulled out, but if I disable it, they are back to working again.

seivad avatar Aug 01 '22 01:08 seivad

this works for me:

const config = { blacklist: ["persist/PERSIST", "persist/REHYDRATE"], };

const middlewares = [createStateSyncMiddleware(config), thunk];

export const store = configureStore({ reducer, middleware: middlewares, });

initStateWithPrevTab(store);

nayabshah avatar Sep 15 '22 10:09 nayabshah

getDefaultMiddleware function and concat other middlewares is work for me

const extraMiddlewares = [createStateSyncMiddleware({  blacklist: 'some/Action'  })]
const store = configureStore({
    devTools: process.env.NODE_ENV !== 'production',
    reducer: rootReducer,
    middleware: (getDefaultMiddleware) =>
      getDefaultMiddleware({
        serializableCheck: {
          ignoredActions: [/* if you needed */],
        },
      }).concat(extraMiddlewares),
  })

spd789562 avatar Sep 16 '22 10:09 spd789562