Open
Description
Almost done with migration to redux-dynamic-modules, but I can't make my epics working.
I use Dependencies Injection because of unit testing:
https://redux-observable.js.org/docs/recipes/InjectingDependenciesIntoEpics.html
import { createEpicMiddleware, combineEpics } from 'redux-observable';
import { ajax } from 'rxjs/ajax';
import rootEpic from './somewhere';
const epicMiddleware = createEpicMiddleware({
dependencies: { getJSON: ajax.getJSON }
});
epicMiddleware.run(rootEpic);
and, for example, I try to create initial store:
export const store = createStore({
initialState: persistedState,
enhancers: [applyMiddleware(epicMiddleware)],
extensions: [getObservableExtension()],
}, commonModule())
And I see that epics are called, but at the moment it calls for dependency - it crushes because of undefined
Any suggestions please?
And another question:
epicMiddleware.run(rootEpic)
- rootEpic is any type, but with redux-dynamic-modules we should use Epic[] here:
export function commonModule(): IEpicModule<ModuleState> {
return {
id: 'module',
reducerMap: moduleReducer,
epics: moduleEpics,
}
}
Where any - type from redux-observable, and I see that Epic type from redux-dynamic-modules-observable allows dependencies:
interface Epic<Input extends Action<any> = any, Output extends Input = Input, State = any, Dependencies = any>
Should I manually call epicMiddleware.run
and what argument with?
Metadata
Metadata
Assignees
Labels
No labels