From 0d38895eb25a7f3708bb2c0a0726f99d9d9018a7 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Mon, 1 Nov 2021 23:19:25 -0400 Subject: [PATCH] Fix uninitialized errorCounts bug in remote DevTools (#936) * Fix bug in remote * Use create instead of connect --- packages/redux-devtools-remote/src/devTools.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/redux-devtools-remote/src/devTools.ts b/packages/redux-devtools-remote/src/devTools.ts index d9b53587..2d5d2e02 100644 --- a/packages/redux-devtools-remote/src/devTools.ts +++ b/packages/redux-devtools-remote/src/devTools.ts @@ -200,7 +200,7 @@ class DevToolsEnhancer> { 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> { ) 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' +