Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(createEpicMiddleware): schedule emitted actions and epic subscription on the queueScheduler #493

Merged
merged 1 commit into from May 23, 2018

Commits on May 23, 2018

  1. feat(createEpicMiddleware): schedule emitted actions and epic subscri…

    …ption on the queueScheduler, so that epic order matters less
    
    BREAKING CHANGE:
    
    You must now provide your rootEpic to `epicMiddleware.run(rootEpic)` instead of passing it to `createEpicMiddleware`. This fixes issues with redux v4 where it's no longer allowed to dispatch actions while middleware is still being setup. See https://redux-observable.js.org/MIGRATION.html
    
    BREAKING CHANGE:
    
    `epicMiddleware.replaceEpic` has been removed. A the equivilant behavior can be accomplished by dispatching your own `END` action that your rootEpic is listening for with a `takeUntil`, then providing the next rootEpic to `epicMiddleware.run(nextRootEpic)`. See https://redux-observable.js.org/MIGRATION.html
    
    BREAKING CHANGE:
    
    Actions your epics emit are now scheduled using the queueScheduler. This is a bit hard to explain (and understand) but as the name suggests, a queue is used. If the queue is empty, the action is emitted as usual, but if that action causes other actions to be emitted they will be queued up until the call stack of the first action returns.
    
    In a large majority of cases this will have no perceivable impact, but it may affect the order of any complex epic-to-epic communication you have.
    
    The benefit is that actions which are emitted by an epic on start up are not missed by epics which come after it. e.g. With `combineEpics(epic1, epic2)` previously if epic1 emitted on startup, epic2 would not receive that action because it had not yet been set up. See https://redux-observable.js.org/MIGRATION.html
    jayphelps committed May 23, 2018
    Copy the full SHA
    d3516bf View commit details
    Browse the repository at this point in the history