Skip to content

Commit 249be38

Browse files
committed
Use maxAge option instead of auto commiting
Fix #84
1 parent 4fc7d0b commit 249be38

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

src/app/store/configureStore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { persistState, instrument } from 'redux-devtools';
44
export default function configureStore(next, subscriber = () => ({}), options = {}) {
55
const { deserializeState, deserializeAction } = options;
66
return compose(
7-
instrument(subscriber),
7+
instrument(subscriber, window.devToolsOptions),
88
persistState(
99
getPersistSession(),
1010
deserializeState,

src/browser/extension/inject/pageScript.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ window.devToolsExtension = function(config = {}) {
4242
window.postMessage(message, '*');
4343
}
4444

45-
function relay(type, state, action, nextActionId) {
45+
function relay(type, state, action, nextActionId, isExcess) {
4646
setTimeout(() => {
4747
const message = {
4848
payload: type === 'STATE' && shouldFilter() ? filterActions(state) : state,
4949
action: action || '',
5050
nextActionId: nextActionId || '',
51-
type: type,
51+
isExcess,
52+
type,
5253
source: 'redux-page',
5354
name: config.name || document.title
5455
};
@@ -155,7 +156,9 @@ window.devToolsExtension = function(config = {}) {
155156
relay('INIT', state, { timestamp: Date.now() });
156157
} else if (!errorOccurred && monitorActions.indexOf(lastAction) === -1) {
157158
if (lastAction === 'JUMP_TO_STATE' || shouldFilter() && isFiltered(action)) return;
158-
relay('ACTION', state, liftedAction, nextActionId);
159+
const { maxAge } = window.devToolsOptions;
160+
const isExcess = maxAge && liftedState.stagedActionIds.length === maxAge;
161+
relay('ACTION', state, liftedAction, nextActionId, isExcess);
159162
} else {
160163
if (errorOccurred && !liftedState.computedStates[liftedState.currentStateIndex].error) errorOccurred = false;
161164
relay('STATE', liftedState);

src/browser/extension/options/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ chrome.runtime.getBackgroundPage( background => {
88
const saveOption = e => {
99
let value;
1010
if (e.target.type === 'checkbox') value = e.target.checked;
11-
else if (e.target.type === 'input') value = Number(e.target.value);
11+
else if (
12+
e.target.type === 'input' || e.target.type === 'text'
13+
) value = Number(e.target.value);
1214
else value = e.target.value;
1315
syncOptions.save(e.target.id, value);
1416
};
@@ -48,7 +50,7 @@ chrome.runtime.getBackgroundPage( background => {
4850
</div>
4951
<div className="input">
5052
<span className="caption">Maximum actions:</span>
51-
<input id="limit" type="text" defaultValue={items.limit} onChange={saveOption}/>
53+
<input id="maxAge" type="text" defaultValue={items.maxAge} onChange={saveOption}/>
5254
<span className="comment">(autocommit when exceeds, 0 - no limit)</span>
5355
</div>
5456
<div className="input">

src/browser/extension/options/syncOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const get = callback => {
1616
leftMonitor: 'LogMonitor',
1717
rightMonitor: 'LogMonitor',
1818
bottomMonitor: 'SliderMonitor',
19-
limit: 50,
19+
maxAge: 50,
2020
filter: false,
2121
whitelist: '',
2222
blacklist: '',

0 commit comments

Comments
 (0)