Skip to content

Commit 4713721

Browse files
committed
Rename CheckFrequency to DevModeCheckFrequency
1 parent dbeec9e commit 4713721

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

src/components/Context.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Context } from 'react'
22
import * as React from 'react'
33
import type { Action, Store, UnknownAction } from 'redux'
4-
import type { CheckFrequency } from '../hooks/useSelector'
4+
import type { DevModeCheckFrequency } from '../hooks/useSelector'
55
import type { Subscription } from '../utils/Subscription'
66

77
export interface ReactReduxContextValue<
@@ -11,8 +11,8 @@ export interface ReactReduxContextValue<
1111
store: Store<SS, A>
1212
subscription: Subscription
1313
getServerState?: () => SS
14-
stabilityCheck: CheckFrequency
15-
identityFunctionCheck: CheckFrequency
14+
stabilityCheck: DevModeCheckFrequency
15+
identityFunctionCheck: DevModeCheckFrequency
1616
}
1717

1818
const ContextKey = Symbol.for(`react-redux-context`)

src/components/Provider.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { Context, ReactNode } from 'react'
22
import * as React from 'react'
3-
import type { ReactReduxContextValue } from './Context'
4-
import { ReactReduxContext } from './Context'
3+
import type { Action, Store, UnknownAction } from 'redux'
4+
import type { DevModeCheckFrequency } from '../hooks/useSelector'
55
import { createSubscription } from '../utils/Subscription'
66
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'
7-
import type { Action, Store, UnknownAction } from 'redux'
8-
import type { CheckFrequency } from '../hooks/useSelector'
7+
import type { ReactReduxContextValue } from './Context'
8+
import { ReactReduxContext } from './Context'
99

1010
export interface ProviderProps<
1111
A extends Action<string> = UnknownAction,
@@ -30,10 +30,10 @@ export interface ProviderProps<
3030
context?: Context<ReactReduxContextValue<S, A> | null>
3131

3232
/** Global configuration for the `useSelector` stability check */
33-
stabilityCheck?: CheckFrequency
33+
stabilityCheck?: DevModeCheckFrequency
3434

3535
/** Global configuration for the `useSelector` identity function check */
36-
identityFunctionCheck?: CheckFrequency
36+
identityFunctionCheck?: DevModeCheckFrequency
3737

3838
children: ReactNode
3939
}

src/hooks/useSelector.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ import {
1010
useReduxContext as useDefaultReduxContext,
1111
} from './useReduxContext'
1212

13-
export type CheckFrequency = 'never' | 'once' | 'always'
13+
/**
14+
* The frequency of development mode checks.
15+
*
16+
* @since 8.1.0
17+
* @internal
18+
*/
19+
export type DevModeCheckFrequency = 'never' | 'once' | 'always'
1420

1521
export interface UseSelectorOptions<Selected = unknown> {
1622
equalityFn?: EqualityFn<Selected>
17-
stabilityCheck?: CheckFrequency
18-
identityFunctionCheck?: CheckFrequency
23+
stabilityCheck?: DevModeCheckFrequency
24+
identityFunctionCheck?: DevModeCheckFrequency
1925
}
2026

2127
export interface UseSelector {
@@ -126,7 +132,9 @@ export function createSelectorHook(
126132
}
127133
}
128134
const finalIdentityFunctionCheck =
129-
typeof identityFunctionCheck === 'undefined' ? globalIdentityFunctionCheck : identityFunctionCheck
135+
typeof identityFunctionCheck === 'undefined'
136+
? globalIdentityFunctionCheck
137+
: identityFunctionCheck
130138
if (
131139
finalIdentityFunctionCheck === 'always' ||
132140
(finalIdentityFunctionCheck === 'once' && firstRun.current)

0 commit comments

Comments
 (0)