Skip to content

Commit 22dc9f2

Browse files
committed
1 parent 7c3b78d commit 22dc9f2

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

packages/redux-devtools-instrument/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-devtools-instrument",
3-
"version": "1.9.4",
3+
"version": "1.9.5",
44
"description": "Redux DevTools instrumentation",
55
"main": "lib/instrument.js",
66
"scripts": {

packages/redux-devtools-instrument/src/instrument.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ export const ActionTypes = {
1919
PAUSE_RECORDING: 'PAUSE_RECORDING'
2020
};
2121

22+
const isChrome = (
23+
typeof window === 'object' && (
24+
typeof window.chrome !== 'undefined' ||
25+
typeof window.process !== 'undefined' &&
26+
window.process.type === 'renderer'
27+
));
28+
29+
const isChromeOrNode = (
30+
isChrome || (typeof process !== 'undefined' && process.release.name === 'node')
31+
);
32+
2233
/**
2334
* Action creators to change the History state.
2435
*/
@@ -46,7 +57,7 @@ export const ActionCreators = {
4657
} else {
4758
const error = Error();
4859
let prevStackTraceLimit;
49-
if (Error.captureStackTrace) {
60+
if (Error.captureStackTrace && isChromeOrNode) { // avoid error-polyfill
5061
if (Error.stackTraceLimit < traceLimit) {
5162
prevStackTraceLimit = Error.stackTraceLimit;
5263
Error.stackTraceLimit = traceLimit;
@@ -130,12 +141,7 @@ function computeWithTryCatch(reducer, action, state) {
130141
nextState = reducer(state, action);
131142
} catch (err) {
132143
nextError = err.toString();
133-
if (
134-
typeof window === 'object' && (
135-
typeof window.chrome !== 'undefined' ||
136-
typeof window.process !== 'undefined' &&
137-
window.process.type === 'renderer'
138-
)) {
144+
if (isChrome) {
139145
// In Chrome, rethrowing provides better source map support
140146
setTimeout(() => { throw err; });
141147
} else {

0 commit comments

Comments
 (0)