|
1 | 1 | import type { PayloadAction } from '@reduxjs/toolkit' |
2 | 2 | import { combineReducers, configureStore, createSlice } from '@reduxjs/toolkit' |
3 | 3 | import { test } from 'vitest' |
4 | | -import type { lruMemoize } from '../src/lruMemoize' |
5 | | -import type { |
6 | | - AnyFunction, |
7 | | - OutputSelector, |
8 | | - SelectorArray, |
9 | | - Simplify |
10 | | -} from '../src/types' |
| 4 | +import type { AnyFunction, OutputSelector, Simplify } from '../src/types' |
11 | 5 |
|
12 | 6 | export interface Todo { |
13 | 7 | id: number |
@@ -437,22 +431,17 @@ export const logRecomputations = <S extends OutputSelector>(selector: S) => { |
437 | 431 | ) |
438 | 432 | } |
439 | 433 |
|
440 | | -export const logSelectorRecomputations = < |
441 | | - S extends OutputSelector<SelectorArray, unknown, typeof lruMemoize, any> |
442 | | ->( |
| 434 | +export const logSelectorRecomputations = <S extends OutputSelector>( |
443 | 435 | selector: S |
444 | 436 | ) => { |
445 | | - console.log( |
446 | | - `\x1B[32m\x1B[1m${selector.name}\x1B[0m result function recalculated:`, |
447 | | - { |
448 | | - resultFunc: selector.recomputations(), |
449 | | - inputSelectors: selector.dependencyRecomputations(), |
450 | | - newResults: |
451 | | - typeof selector.memoizedResultFunc.resultsCount === 'function' |
452 | | - ? selector.memoizedResultFunc.resultsCount() |
453 | | - : undefined |
454 | | - } |
455 | | - ) |
| 437 | + console.log(`\x1B[32m\x1B[1m${selector.name}\x1B[0m:`, { |
| 438 | + resultFunc: selector.recomputations(), |
| 439 | + inputSelectors: selector.dependencyRecomputations(), |
| 440 | + newResults: |
| 441 | + typeof selector.memoizedResultFunc.resultsCount === 'function' |
| 442 | + ? selector.memoizedResultFunc.resultsCount() |
| 443 | + : undefined |
| 444 | + }) |
456 | 445 | // console.log( |
457 | 446 | // `\x1B[32m\x1B[1m${selector.name}\x1B[0m result function recalculated:`, |
458 | 447 | // `\x1B[33m${selector.recomputations().toLocaleString('en-US')}\x1B[0m`, |
|
0 commit comments