Can't use combineEpics with redux-dynamic-modules-observable
The code uses toString() to check uniqueness on Epics, but when using combineEpics the result is always the same which means that if two modules use combineEpics only the first module's epic will actually be loaded.
Is there a way to determine epic uniqueness without using toString()?
https://github.com/microsoft/redux-dynamic-modules/blob/163377fdd9118a231c22d42d093374cdd615a1f7/packages/redux-dynamic-modules-observable/src/EpicManager.ts#L40
We have a factory that creates epics for metering/debouncing calls. We got around this issue by adding a name property to each epic and then epicKey = `${epic.name} ${epic.toString}
Maybe it's not a good pattern to use combineEpics. My practice for many epics in a file, I'll try this way:
// epic.ts
export function epicOne () {}
export function epicTwo () {}
// rdm.ts
import reducer from './reducer';
import * as epics from './epic';
export default {
// Unique id of the module
id: 'entry',
// Maps the Store key to the reducer
reducerMap: {
entry: reducer,
},
epics: Object.values(epics),
}
It's recommended to import epics as needed.