-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REPLACE action for replaceReducers (#2673)
* Add an explicit private action type for replacing reducers * Make this a const while we're at it... * Triple equals for lint * Add a random string to the "private" actions.
- Loading branch information
Showing
4 changed files
with
32 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,9 @@ | |
* If the current state is undefined, you must return the initial state. | ||
* Do not reference these action types directly in your code. | ||
*/ | ||
var ActionTypes = { | ||
INIT: '@@redux/INIT' | ||
const ActionTypes = { | ||
INIT: '@@redux/INIT' + Math.random().toString(36).substring(7).split('').join('.'), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
cyberhck
|
||
REPLACE: '@@redux/REPLACE' + Math.random().toString(36).substring(7).split('').join('.') | ||
} | ||
|
||
export default ActionTypes |
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
Just curious, why is this actually necessary? Normally we'd just say to user this is private action, and not to use them, which is mentioned so in the comment. This feels more like restriction, rather than suggestion. I do have a case where I'd actually want to capture this in my saga and also dispatch my separate "INIT"