Skip to content

Commit 89dfbe8

Browse files
committed
Send config to the monitor
1 parent dcd346e commit 89dfbe8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/browser/extension/inject/pageScript.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const devToolsExtension = function(reducer, preloadedState, config) {
8787
}, true, true);
8888
}
8989

90-
function relay(type, state, action, nextActionId, shouldInit) {
90+
function relay(type, state, action, nextActionId, libConfig) {
9191
const message = {
9292
type,
9393
payload: filterState(
@@ -101,19 +101,18 @@ const devToolsExtension = function(reducer, preloadedState, config) {
101101
message.action = !actionSanitizer ? action : actionSanitizer(action.action, nextActionId - 1);
102102
message.maxAge = maxAge;
103103
message.nextActionId = nextActionId;
104-
} else if (shouldInit) {
105-
message.action = action;
106-
message.name = config.name || document.title;
104+
} else if (libConfig) {
105+
message.libConfig = libConfig;
107106
}
108107

109108
toContentScript(message, serializeState, serializeAction);
110109
}
111110

112-
const relayState = throttle((liftedState, actions, shouldInit) => {
111+
const relayState = throttle((liftedState, libConfig) => {
113112
relayAction.cancel();
114113
const state = liftedState || store.liftedStore.getState();
115114
sendingActionId = state.nextActionId;
116-
relay('STATE', state, actions, undefined, shouldInit);
115+
relay('STATE', state, undefined, undefined, libConfig);
117116
}, latency);
118117

119118
const relayAction = throttle(() => {
@@ -210,7 +209,11 @@ const devToolsExtension = function(reducer, preloadedState, config) {
210209
if (!actionCreators && config.actionCreators) {
211210
actionCreators = getActionsArray(config.actionCreators);
212211
}
213-
relayState(undefined, JSON.stringify(actionCreators), true);
212+
relayState(undefined, {
213+
name: config.name || document.title,
214+
actionCreators: JSON.stringify(actionCreators),
215+
type: 'redux'
216+
});
214217

215218
if (reportId) {
216219
relay('GET_REPORT', reportId);

0 commit comments

Comments
 (0)