Skip to content

Instantly share code, notes, and snippets.

@amadeus
Created October 1, 2020 00:42
Show Gist options
  • Save amadeus/c1ceff0d3d66cf8a40f8e2700aad1f2e to your computer and use it in GitHub Desktop.
Save amadeus/c1ceff0d3d66cf8a40f8e2700aad1f2e to your computer and use it in GitHub Desktop.
if (this._interceptor == null || !this._interceptor(action)) {
mark(action.type);
this._currentDispatchActionType = action.type;
try {
const actionHandlers =
this._orderedActionHandlers[action.type] || this._computeOrderedActionHandlers(action.type);
for (let i = 0, l = actionHandlers.length; i < l; i++) {
const {actionHandler, storeDidChange} = actionHandlers[i];
if (actionHandler(action) !== false) {
storeDidChange(action);
}
}
Store.emitChanges();
// Possible fix for FF dirty dispatch exceptions
// Assumption is that FF is maybe executing a finally block after a setTimeout(0)???
this._currentDispatchActionType = null;
} catch (e) {
console.warn('Dispatch Error', e);
} finally {
this._currentDispatchActionType = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment