mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-22 01:26:48 +03:00
Fix uninitialized errorCounts bug in remote DevTools (#936)
* Fix bug in remote * Use create instead of connect
This commit is contained in:
parent
beb02ebe6d
commit
0d38895eb2
|
@ -200,7 +200,7 @@ class DevToolsEnhancer<S, A extends Action<unknown>> {
|
|||
sendOn: readonly string[] | undefined;
|
||||
sendOnError: number | undefined;
|
||||
channel?: string;
|
||||
errorCounts?: { [errorName: string]: number };
|
||||
errorCounts: { [errorName: string]: number } = {};
|
||||
lastAction?: unknown;
|
||||
paused?: boolean;
|
||||
locked?: boolean;
|
||||
|
@ -423,17 +423,17 @@ class DevToolsEnhancer<S, A extends Action<unknown>> {
|
|||
)
|
||||
return;
|
||||
|
||||
this.socket = socketCluster.connect(this.socketOptions);
|
||||
this.socket = socketCluster.create(this.socketOptions);
|
||||
|
||||
this.socket.on('error', (err) => {
|
||||
// if we've already had this error before, increment it's counter, otherwise assign it '1' since we've had the error once.
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
this.errorCounts![err.name] = this.errorCounts!.hasOwnProperty(err.name)
|
||||
? this.errorCounts![err.name] + 1
|
||||
this.errorCounts[err.name] = this.errorCounts.hasOwnProperty(err.name)
|
||||
? this.errorCounts[err.name] + 1
|
||||
: 1;
|
||||
|
||||
if (this.suppressConnectErrors) {
|
||||
if (this.errorCounts![err.name] === 1) {
|
||||
if (this.errorCounts[err.name] === 1) {
|
||||
console.log(
|
||||
'remote-redux-devtools: Socket connection errors are being suppressed. ' +
|
||||
'\n' +
|
||||
|
|
Loading…
Reference in New Issue
Block a user