Skip to content

Commit

Permalink
Update redux enhancer API from upstream (better Immutable support)
Browse files Browse the repository at this point in the history
Add `serialize` option
  • Loading branch information
jhen0409 committed Feb 24, 2017
1 parent 66480cf commit 5ae0fa1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions app/worker/reduxAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getActionsArray,
generateId,
stringify,
getSeralizeParameter,
} from 'remotedev-utils';
import importState from 'remotedev-utils/lib/importState';
import {
Expand Down Expand Up @@ -58,8 +59,12 @@ function relay(type, state, instance, action, nextActionId) {
);
message.isExcess = isExcess;
message.nextActionId = nextActionId;
} else if (action) {
message.action = stringify(action, serializeAction);
} else if (instance) {
message.libConfig = {
type: 'redux',
actionCreators: stringify(instance.actionCreators),
serialize: !!instance.serialize,
};
}
postMessage({ __IS_REDUX_NATIVE_MESSAGE__: true, content: message });
}
Expand Down Expand Up @@ -154,7 +159,7 @@ function start(instance) {
if (typeof actionCreators === 'function') {
instance.actionCreators = actionCreators();
}
relay('STATE', getLiftedState(store, filters), instance, instance.actionCreators);
relay('STATE', getLiftedState(store, filters), instance);
}

function checkForReducerErrors(liftedState, instance) {
Expand Down Expand Up @@ -212,12 +217,14 @@ export default function devToolsEnhancer(options = {}) {
stateSanitizer,
deserializeState,
deserializeAction,
serializeState,
serializeAction,
serialize,
predicate,
} = options;
const id = generateId(options.instanceId);

const serializeState = getSeralizeParameter(options, 'serializeState');
const serializeAction = getSeralizeParameter(options, 'serializeAction');

return next => (reducer, initialState) => {
const store = configureStore(
next, monitorReducer, {
Expand Down Expand Up @@ -245,6 +252,7 @@ export default function devToolsEnhancer(options = {}) {
deserializeAction,
serializeState,
serializeAction,
serialize,
predicate,
};

Expand Down
2 changes: 1 addition & 1 deletion scripts/patch-react-devtools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo '\n\n## PATCH REACT DEVTOOLS\n'

FILE='./node_modules/react-devtools-core/vendor/backend-1.0.6.js'
FILE='./dist/node_modules/react-devtools-core/vendor/backend-1.0.6.js'

TARGET='window.requestIdleCallback'
REPLACE='window.__REQUEST_IDLE_CALLBACK_REPLACED_BY_PATCH__'
Expand Down

0 comments on commit 5ae0fa1

Please sign in to comment.