Add support for complex sagas asynchronously initializing the store state at server-side#438
Open
jurca wants to merge 6 commits intokirill-konshin:7.xfrom
Open
Add support for complex sagas asynchronously initializing the store state at server-side#438jurca wants to merge 6 commits intokirill-konshin:7.xfrom
jurca wants to merge 6 commits intokirill-konshin:7.xfrom
Conversation
This saga monitor factory can be used to use complex redux sagas dependant on redux actions dispatched by each other for redux store state initialization at the server. The initialization is deemed completed once every saga is either terminated or waiting on a redux action.
This fixes compatibility with init saga that wait for another init saga's outcome being provided through a redux action - this is useful if there are multiple consumers of the outcome of a single saga.
Author
|
@kirill-konshin Would you mind taking a look at this pull request, please? |
|
This solution may resolve this bug #515 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current usage example does not correctly handle some cases of sagas initializing the store. If saga
Ais waiting for the result of an asynchronous operation done by sagaB, with the result dispatched as a redux action, sagaAwould never receive the result-carrying action because theENDaction is dispatched too soon in such a case. (This pattern enables multiple sagas to receive the result ofAwhile having to executeAonly once).This PR handles such use cases by introducing a saga monitor that observes saga activity and reports once every saga has either terminated or is waiting for a redux action (this is an assumption that the saga at hand awaits a user action that would dispatch the expected action, and can be terminated using the
ENDaction).