-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7f13c8
commit de35e19
Showing
3 changed files
with
146 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
de35e19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now
__batchStart()
throws an error if a batch is already in progress. This means that if you have two actions that usebatch()
, then you can't compose them into a higher-level batched action.I haven't run into this as an issue myself yet, but can see if being a problem.
Perhaps instead of a flag, you can keep a
__batchCount
of batches in progress and only consider notifying when the__batchCount
reaches zero in__batchEnd()
? (__batchCount
is obviously different than__batchDispatchCount
).de35e19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this came across. I choose not to use a
__batchCount
and throw an error to keep things simpler, however the more I am thinking about it the more it seems pretty safe to allow nested batches as people wont be manually calling__batchStart()
and__batchEnd()
de35e19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safe, and I think actions should always be composable.