You can use a .filter()
predicate to only unsubscribe your mergeMap for the exact uid
you are looking for:
export const getUserEpic = action$ => action$
.ofType(t.GET_USER)
.mergeMap(action => Observable
.from(query.findUser(action.uid))
.map(user => ({ type: t.GET_USER_SUCCESS, user }))
.takeUntil(
action$
.ofType(t.GET_USER_CANCELLED)
.filter(act => act.uid === action.uid)
)
1
solved Redux Observable: If the same action is dispatched multiple times, how do I cancel one of them?