SebastianStehle / yjs-redux

MIT License
13 stars 1 forks source link

Cannot use default middlewares #7

Open fredericrous opened 8 months ago

fredericrous commented 8 months ago

example code:

const binder = createYjsReduxBinder(options);

const rootReducer = binder.enhanceReducer(combineReducers({
  builder: builderReducer,
}));

configureStore({
  reducer: rootReducer,
  middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(binder.middleware as any),
});

the error

Error: Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.

workaround is to not use the default middlewares

middleware: (getDefaultMiddleware) => [binder.middleware as any]

I think that should maybe not be fixed but at least documented

SebastianStehle commented 8 months ago

I cannot remember that i have experienced this issue. Weird.