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

Fix: action order with synchronous effects #26

Conversation

GrzegorzKazana
Copy link
Contributor

Fixes #21

Actions created in effects are nexted into the action stream on async tick. This allows actions which triggered the epic to be handled before the newly created one.

store.state$.subscribe();
store.action$.next(aAction);

await awaitNMockCalls(reducerMock, 4);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I wanted to avoid, asyncScheduler makes everything async which might be not desirable if you are operating on sync effects. I was also experimenting with queueScheduler but I couldn't get it working properly.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the majority of cases, It probably won't matter though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, had the same reflection... But it is definitely the simplest fix 🤷

@grzegorz-bielski grzegorz-bielski merged commit 6ee3141 into grzegorz-bielski:master Sep 20, 2020
@GrzegorzKazana GrzegorzKazana deleted the fix-sync-effect-action-order branch September 20, 2020 10:15
@grzegorz-bielski
Copy link
Owner

Thx @GrzegorzKazana! merging this.
This is still a breaking change. I'll release it under a new major version, as a pre-release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected action order with synchronous epics
2 participants