Socket
Socket
Sign inDemoInstall

redux-devtools-instrument

Package Overview
Dependencies
2
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.3.0

47

lib/instrument.js

@@ -44,3 +44,4 @@ 'use strict';

IMPORT_STATE: 'IMPORT_STATE',
LOCK_CHANGES: 'LOCK_CHANGES'
LOCK_CHANGES: 'LOCK_CHANGES',
PAUSE_RECORDING: 'PAUSE_RECORDING'
};

@@ -91,2 +92,5 @@

return { type: ActionTypes.LOCK_CHANGES, status: status };
},
pauseRecording: function pauseRecording(status) {
return { type: ActionTypes.PAUSE_RECORDING, status: status };
}

@@ -185,3 +189,4 @@ };

computedStates: [],
dropNewActions: false
isLocked: options.shouldStartLocked === true,
isPaused: options.shouldRecordChanges === false
};

@@ -203,3 +208,4 @@

var computedStates = _ref.computedStates;
var dropNewActions = _ref.dropNewActions;
var isLocked = _ref.isLocked;
var isPaused = _ref.isPaused;

@@ -342,6 +348,22 @@

{
if (dropNewActions) {
if (isLocked) {
return liftedState || initialLiftedState;
}
if (isPaused) {
var computedState = computeNextEntry(reducer, liftedAction.action, computedStates[currentStateIndex].state, false);
return {
monitorState: monitorState,
actionsById: { 0: liftAction(INIT_ACTION) },
nextActionId: 1,
stagedActionIds: [0],
skippedActionIds: [],
committedState: computedState.state,
currentStateIndex: 0,
computedStates: [computedState],
dropNewActions: false,
isPaused: true
};
}
// Auto-commit as new actions come in.

@@ -405,9 +427,19 @@ if (options.maxAge && stagedActionIds.length === options.maxAge) {

{
dropNewActions = liftedAction.status;
isLocked = liftedAction.status;
minInvalidatedStateIndex = Infinity;
break;
}
case ActionTypes.PAUSE_RECORDING:
{
isPaused = liftedAction.status;
minInvalidatedStateIndex = Infinity;
break;
}
case '@@redux/INIT':
{
// Always recompute states on hot reload and init.
if (options.shouldHotReload === false && liftedState) {
return liftedState;
}
// Recompute states on hot reload and init.
minInvalidatedStateIndex = 0;

@@ -447,3 +479,4 @@

computedStates: computedStates,
dropNewActions: dropNewActions
isLocked: isLocked,
isPaused: isPaused
};

@@ -450,0 +483,0 @@ };

2

package.json
{
"name": "redux-devtools-instrument",
"version": "1.2.0",
"version": "1.3.0",
"description": "Redux DevTools instrumentation",

@@ -5,0 +5,0 @@ "main": "lib/instrument.js",

@@ -49,2 +49,5 @@ Redux DevTools Instrumentation

- **shouldCatchErrors** *boolean* - if specified as `true`, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched.
- **shouldRecordChanges** *boolean* - if specified as `false`, it will not record the changes till `pauseRecording(false)` is dispatched. Default is `true`.
- **shouldStartLocked** *boolean* - if specified as `true`, it will not allow any non-monitor actions to be dispatched till `lockChanges(false)` is dispatched. Default is `false`.
- **shouldHotReload** *boolean* - if set to `false`, will not recompute the states on hot reloading (or on replacing the reducers). Default to `true`.

@@ -51,0 +54,0 @@ ### License

@@ -16,3 +16,4 @@ import difference from 'lodash/difference';

IMPORT_STATE: 'IMPORT_STATE',
LOCK_CHANGES: 'LOCK_CHANGES'
LOCK_CHANGES: 'LOCK_CHANGES',
PAUSE_RECORDING: 'PAUSE_RECORDING'
};

@@ -76,2 +77,6 @@

return { type: ActionTypes.LOCK_CHANGES, status };
},
pauseRecording(status) {
return { type: ActionTypes.PAUSE_RECORDING, status };
}

@@ -186,3 +191,4 @@ };

computedStates: [],
dropNewActions: false
isLocked: options.shouldStartLocked === true,
isPaused: options.shouldRecordChanges === false
};

@@ -203,3 +209,4 @@

computedStates,
dropNewActions
isLocked,
isPaused
} = liftedState || initialLiftedState;

@@ -323,6 +330,24 @@

case ActionTypes.PERFORM_ACTION: {
if (dropNewActions) {
if (isLocked) {
return liftedState || initialLiftedState;
}
if (isPaused) {
const computedState = computeNextEntry(
reducer, liftedAction.action, computedStates[currentStateIndex].state, false
);
return {
monitorState: monitorState,
actionsById: { 0: liftAction(INIT_ACTION) },
nextActionId: 1,
stagedActionIds: [0],
skippedActionIds: [],
committedState: computedState.state,
currentStateIndex: 0,
computedStates: [computedState],
dropNewActions: false,
isPaused: true
};
}
// Auto-commit as new actions come in.

@@ -383,8 +408,17 @@ if (options.maxAge && stagedActionIds.length === options.maxAge) {

case ActionTypes.LOCK_CHANGES: {
dropNewActions = liftedAction.status;
isLocked = liftedAction.status;
minInvalidatedStateIndex = Infinity;
break;
}
case ActionTypes.PAUSE_RECORDING: {
isPaused = liftedAction.status;
minInvalidatedStateIndex = Infinity;
break;
}
case '@@redux/INIT': {
// Always recompute states on hot reload and init.
if (options.shouldHotReload === false && liftedState) {
return liftedState;
}
// Recompute states on hot reload and init.
minInvalidatedStateIndex = 0;

@@ -441,3 +475,4 @@

computedStates,
dropNewActions
isLocked,
isPaused
};

@@ -444,0 +479,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc