diff --git a/packages/redux-devtools-remote/src/configureStore.ts b/packages/redux-devtools-remote/src/configureStore.ts index 4f780b20fe..8cf94094d1 100644 --- a/packages/redux-devtools-remote/src/configureStore.ts +++ b/packages/redux-devtools-remote/src/configureStore.ts @@ -1,3 +1,5 @@ +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore import { instrument, Options } from '@redux-devtools/instrument'; import { Action, Reducer, StoreEnhancerStoreCreator } from 'redux'; diff --git a/packages/redux-devtools-remote/src/devTools.ts b/packages/redux-devtools-remote/src/devTools.ts index 6f517df11f..a50b9b4033 100644 --- a/packages/redux-devtools-remote/src/devTools.ts +++ b/packages/redux-devtools-remote/src/devTools.ts @@ -11,11 +11,14 @@ import { StoreEnhancer, StoreEnhancerStoreCreator, } from 'redux'; + import { EnhancedStore, LiftedAction, LiftedState, PerformAction, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore } from '@redux-devtools/instrument'; import { ActionCreatorObject, @@ -29,6 +32,8 @@ import { filterState, LocalFilter, State, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore } from '@redux-devtools/utils'; function async(fn: () => unknown) { @@ -271,6 +276,7 @@ class DevToolsEnhancer> { !this.actionSanitizer ? action : this.actionSanitizer( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument (action as PerformAction).action, nextActionId! - 1, ), @@ -400,7 +406,16 @@ class DevToolsEnhancer> { )) as string; this.channel = channelName; // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - for await (const data of this.socket!.subscribe(channelName)) { + // for await (const data of this.socket!.subscribe(channelName)) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + const consumer = this.socket!.listener(channelName).createConsumer(); + // eslint-disable-next-line no-constant-condition + while (true) { + const { value: data, done } = await consumer.next(); + if (done) break; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore this.handleMessages(data as Message); } } catch (error) { @@ -433,8 +448,11 @@ class DevToolsEnhancer> { void (async () => { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - for await (const data of this.socket!.listener('error')) { - // if we've already had this error before, increment it's counter, otherwise assign it '1' since we've had the error once. + const consumer = this.socket!.listener('error').createConsumer(); + // eslint-disable-next-line no-constant-condition + while (true) { + const { value: data, done } = await consumer.next(); + if (done) break; // 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,@typescript-eslint/no-unsafe-argument this.errorCounts[data.error.name] = this.errorCounts.hasOwnProperty( data.error.name, @@ -459,15 +477,22 @@ class DevToolsEnhancer> { void (async () => { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - for await (const data of this.socket!.listener('connect')) { + const consumer = this.socket!.listener('connect').createConsumer(); + // eslint-disable-next-line no-constant-condition + while (true) { + const { done } = await consumer.next(); + if (done) break; console.log('connected to remotedev-server'); this.errorCounts = {}; // clear the errorCounts object, so that we'll log any new errors in the event of a disconnect this.login(); } })(); void (async () => { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - for await (const data of this.socket!.listener('disconnect')) { + const consumer = this.socket!.listener('disconnect').createConsumer(); + // eslint-disable-next-line no-constant-condition + while (true) { + const { done } = await consumer.next(); + if (done) break; this.stop(true); } })(); @@ -525,6 +550,7 @@ class DevToolsEnhancer> { const nextActionId = liftedState.nextActionId; const liftedAction = liftedState.actionsById[nextActionId - 1]; if (isFiltered(liftedAction.action, this.filters)) return; + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this.relay('ACTION', state, liftedAction, nextActionId); if (!this.isExcess && maxAge) this.isExcess = liftedState.stagedActionIds.length >= maxAge; @@ -566,13 +592,14 @@ class DevToolsEnhancer> { shouldHotReload: options.shouldHotReload, shouldRecordChanges: options.shouldRecordChanges, shouldStartLocked: options.shouldStartLocked, - pauseActionType: options.pauseActionType || '@@PAUSED', + pauseActionType: options.pauseActionType || '@@Paused', })(reducer, initialState); if (realtime) this.start(); this.store.subscribe(() => { if (this.isMonitored) this.handleChange( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this.store.getState(), this.getLiftedStateRaw(), maxAge,