diff --git a/package.json b/package.json index 540addd1..cb8f6821 100644 --- a/package.json +++ b/package.json @@ -81,8 +81,8 @@ "react-redux": "^4.4.5", "redux": "^3.5.2", "redux-devtools": "^3.4.1", - "redux-devtools-instrument": "^1.9.0", - "remotedev-app": "^0.10.9", + "redux-devtools-instrument": "^1.9.2", + "remotedev-app": "^0.10.10", "remotedev-monitor-components": "^0.0.5", "remotedev-serialize": "0.1.4", "remotedev-slider": "^1.1.1", diff --git a/src/app/stores/enhancerStore.js b/src/app/stores/enhancerStore.js index 4117a766..dff3a4b4 100644 --- a/src/app/stores/enhancerStore.js +++ b/src/app/stores/enhancerStore.js @@ -12,7 +12,7 @@ export default function configureStore(next, monitorReducer, config) { instrument( monitorReducer, { - maxAge: config.maxAge || window.devToolsOptions.maxAge || 50, + maxAge: config.maxAge, shouldCatchErrors: config.shouldCatchErrors || window.shouldCatchErrors, shouldHotReload: config.shouldHotReload, shouldRecordChanges: config.shouldRecordChanges, diff --git a/src/browser/extension/inject/contentScript.js b/src/browser/extension/inject/contentScript.js index fab54d11..12cabe03 100644 --- a/src/browser/extension/inject/contentScript.js +++ b/src/browser/extension/inject/contentScript.js @@ -1,4 +1,4 @@ -import { injectOptions, isAllowed } from '../options/syncOptions'; +import { injectOptions, getOptionsFromBg, isAllowed } from '../options/syncOptions'; const source = '@devtools-extension'; let connected = false; let bg; @@ -58,6 +58,7 @@ function tryCatch(fn, args) { function send(message) { if (!connected) connect(); if (message.type === 'INIT_INSTANCE') { + getOptionsFromBg(); bg.postMessage({ name: 'INIT_INSTANCE', instanceId: message.instanceId }); } else { bg.postMessage({ name: 'RELAY', message }); diff --git a/src/browser/extension/inject/pageScript.js b/src/browser/extension/inject/pageScript.js index fe1e0d2e..f52a9167 100644 --- a/src/browser/extension/inject/pageScript.js +++ b/src/browser/extension/inject/pageScript.js @@ -34,7 +34,7 @@ const __REDUX_DEVTOOLS_EXTENSION__ = function(reducer, preloadedState, config) { let store; let errorOccurred = false; - let maxAge; + let maxAge = config.maxAge; let actionCreators; let sendingActionId = 1; const instanceId = generateId(config.instanceId); @@ -91,7 +91,7 @@ const __REDUX_DEVTOOLS_EXTENSION__ = function(reducer, preloadedState, config) { if (type === 'ACTION') { message.action = !actionSanitizer ? action : actionSanitizer(action.action, nextActionId - 1); - message.maxAge = maxAge; + message.maxAge = getMaxAge(); message.nextActionId = nextActionId; } else if (libConfig) { message.libConfig = libConfig; @@ -144,7 +144,7 @@ const __REDUX_DEVTOOLS_EXTENSION__ = function(reducer, preloadedState, config) { payload, source, instanceId, - maxAge + maxAge: getMaxAge() }, serializeState, serializeAction); }, latency); @@ -233,9 +233,9 @@ const __REDUX_DEVTOOLS_EXTENSION__ = function(reducer, preloadedState, config) { } } - function init() { - maxAge = config.maxAge || window.devToolsOptions.maxAge || 50; + const getMaxAge = () => maxAge || window.devToolsOptions.maxAge || 50; + function init() { setListener(onMessage, instanceId); notifyErrors(() => { errorOccurred = true; @@ -274,7 +274,7 @@ const __REDUX_DEVTOOLS_EXTENSION__ = function(reducer, preloadedState, config) { if (!isAllowed(window.devToolsOptions)) return next(reducer_, initialState_, enhancer_); store = stores[instanceId] = - configureStore(next, monitor.reducer, config)(reducer_, initialState_, enhancer_); + configureStore(next, monitor.reducer, { ...config, maxAge: getMaxAge })(reducer_, initialState_, enhancer_); if (isInIframe()) setTimeout(init, 3000); else init(); diff --git a/yarn.lock b/yarn.lock index b932e263..f1a1e66c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7341,7 +7341,7 @@ redux-devtools-chart-monitor@^1.6.1: react-pure-render "^1.0.2" redux-devtools-themes "^1.0.0" -redux-devtools-instrument@^1.0.1, redux-devtools-instrument@^1.9.0: +redux-devtools-instrument@^1.0.1: version "1.9.0" resolved "https://registry.yarnpkg.com/redux-devtools-instrument/-/redux-devtools-instrument-1.9.0.tgz#2faed9ac3292c783284b21843edfaa0567764a0c" integrity sha512-pLFQoja1ojpsSRTWbC9yyc/a+z8uwOD7FPKLp+Abs7qjsah6khA5o8HBE2wa0VipE5vniYINdkNyxV/2iWADKg== @@ -7349,6 +7349,14 @@ redux-devtools-instrument@^1.0.1, redux-devtools-instrument@^1.9.0: lodash "^4.2.0" symbol-observable "^1.0.2" +redux-devtools-instrument@^1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/redux-devtools-instrument/-/redux-devtools-instrument-1.9.2.tgz#c8bb81f295c60f1629164391c9c8552346d551c0" + integrity sha512-6ydVkHuAWPDRmEoVjPyJNF60y5pT6nIVyDXpTz2klGHu7oR+j3QJRMvRyyPYZMThePd8JIkh8/6L4zDXKED6aA== + dependencies: + lodash "^4.2.0" + symbol-observable "^1.0.2" + redux-devtools-log-monitor@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/redux-devtools-log-monitor/-/redux-devtools-log-monitor-1.2.0.tgz#136a202f999c659a13fbb5c50793106e80722311" @@ -7462,10 +7470,10 @@ regjsparser@^0.1.4: dependencies: jsesc "~0.5.0" -remotedev-app@^0.10.9: - version "0.10.9" - resolved "https://registry.yarnpkg.com/remotedev-app/-/remotedev-app-0.10.9.tgz#415e0bfa7328a9e8f47a2a9fc86595738fbb4484" - integrity sha512-m/NfJ3t50XgIwFO2Z0+Wv2xzZ1jyH7U0eUBe/k/wtwJTU6UHdARwKeZPJ43wotqWFB1QOPBe/8k9V/uAOI4bKw== +remotedev-app@^0.10.10: + version "0.10.10" + resolved "https://registry.yarnpkg.com/remotedev-app/-/remotedev-app-0.10.10.tgz#846572cc08bcaaa80d53390dfba97eb7a020ef63" + integrity sha512-ChmS1Z+TWX+HNIuO5GPi+Gdd2JKVvUeEyB2rIxUliOx8Y127T9vqBqbASBc8S+t43S7QdWCHt1nbI/0iPyErZA== dependencies: chrome-storage-local "^0.1.6" d3-state-visualizer "^1.3.1"