-
Notifications
You must be signed in to change notification settings - Fork 33
add defaultState from the original reducers to the namespaced ones #100
Changes from 2 commits
f8abcb9
2f9afe6
3fa53e7
a62835f
5558650
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,10 @@ | |
|
||
import hasNamespace from '../actions/hasNamespace' | ||
import isGlobal from '../actions/isGlobal' | ||
import isReduxSpecific from '../actions/reduxSpecific' | ||
|
||
const processAction = (namespace) => (action, callback, defaultValue) => { | ||
if (!namespace || isGlobal(action)) { | ||
if (!namespace || isGlobal(action) || isReduxSpecific(action)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This case should get a specific unit test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add tests a bit later |
||
return callback(action) | ||
} else if (hasNamespace(action, namespace)) { | ||
return callback({...action, type: action.type.substring(namespace.length + 1)}) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,13 @@ | ||||||
/** | ||||||
* Copyright 2017, IOOF Holdings Limited. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Github wont let me commit this (no permission to push the change, presumable to your fork), but yes. |
||||||
* All rights reserved. | ||||||
* | ||||||
* This source code is licensed under the BSD-style license found in the | ||||||
* LICENSE file in the root directory of this source tree. | ||||||
*/ | ||||||
|
||||||
const REDUX_PREFIX = '@@redux/' | ||||||
|
||||||
const reduxSpecific = (action) => action.type.startsWith(REDUX_PREFIX) | ||||||
|
||||||
export default reduxSpecific | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add correct file ending |
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'd be tempted to move this into the
isGlobal
check. Essentially we are saying that redux actions are always global actions.