Skip to content

Commit 83a4313

Browse files
committed
Fix @typescript-eslint/no-unused-expressions related issues
1 parent f8fe2b5 commit 83a4313

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

packages/toolkit/src/immutableStateInvariantMiddleware.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Middleware } from 'redux'
22
import type { IgnorePaths } from './serializableStateInvariantMiddleware'
3+
import type { AnyObject } from './tsHelpers'
34
import { getTimeMeasureUtils } from './utils'
45

56
type EntryProcessor = (key: string, value: any) => any
@@ -190,8 +191,16 @@ export function createImmutableStateInvariantMiddleware(
190191
return function (this: any, key: string, value: any) {
191192
if (stack.length > 0) {
192193
const thisPos = stack.indexOf(this)
193-
~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
194-
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
194+
if (~thisPos) {
195+
stack.splice(thisPos + 1)
196+
} else {
197+
stack.push(this)
198+
}
199+
if (~thisPos) {
200+
keys.splice(thisPos, Infinity, key)
201+
} else {
202+
keys.push(key)
203+
}
195204
if (~stack.indexOf(value)) value = decycler!.call(this, key, value)
196205
} else stack.push(value)
197206

packages/toolkit/src/query/tests/cacheCollection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ test(`query: handles large keepUnuseDataFor values over 32-bit ms`, async () =>
8787
expect(onCleanup).not.toHaveBeenCalled()
8888

8989
// _Should_ be called _wayyyy_ in the future (like 24.8 days from now)
90-
vi.advanceTimersByTime(THIRTY_TWO_BIT_MAX_TIMER_SECONDS * 1000),
91-
expect(onCleanup).toHaveBeenCalled()
90+
vi.advanceTimersByTime(THIRTY_TWO_BIT_MAX_TIMER_SECONDS * 1000)
91+
expect(onCleanup).toHaveBeenCalled()
9292
})
9393

9494
describe(`query: await cleanup, keepUnusedDataFor set`, () => {

0 commit comments

Comments
 (0)