Skip to content

Instantly share code, notes, and snippets.

@dzNavitski
Created May 12, 2017 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dzNavitski/cb14507ac0e8247d6909b5638f94cbe4 to your computer and use it in GitHub Desktop.
Save dzNavitski/cb14507ac0e8247d6909b5638f94cbe4 to your computer and use it in GitHub Desktop.
Cancel epic
const editEpic = (action$, store) => action$
.ofType(t.EDIT_UPDATE)
.debounceTime(100)
.mergeMap((action) => {
const { path } = action.meta;
return validate$()
.delay(3000)
.map(() => modelActions.modelSetPendingValidation({ value: false, path: path }))
.takeUntil(
action$.ofType(t.EDIT_UPDATE, modelActionTypes.MODEL_REMOVE_VALUE)
.filter(newAction => path === newAction.meta.path)
)
.startWith(modelActions.modelSetPendingValidation({ value: true, path: path }));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment