Skip to content

Commit 157e6c9

Browse files
committed
Bring all of devModeChecks underneath process.env.NODE_ENV checks
1 parent 9f81f91 commit 157e6c9

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/hooks/useSelector.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export function createSelectorHook(
148148
| EqualityFn<NoInfer<Selected>>
149149
| UseSelectorOptions<NoInfer<Selected>> = {},
150150
): Selected => {
151-
const { equalityFn = refEquality, devModeChecks = {} } =
151+
const { equalityFn = refEquality } =
152152
typeof equalityFnOrOptions === 'function'
153153
? { equalityFn: equalityFnOrOptions }
154154
: equalityFnOrOptions
@@ -166,13 +166,9 @@ export function createSelectorHook(
166166
}
167167
}
168168

169-
const {
170-
store,
171-
subscription,
172-
getServerState,
173-
stabilityCheck,
174-
identityFunctionCheck,
175-
} = useReduxContext()
169+
const reduxContext = useReduxContext()
170+
171+
const { store, subscription, getServerState } = reduxContext
176172

177173
const firstRun = React.useRef(true)
178174

@@ -181,6 +177,11 @@ export function createSelectorHook(
181177
[selector.name](state: TState) {
182178
const selected = selector(state)
183179
if (process.env.NODE_ENV !== 'production') {
180+
const { devModeChecks = {} } =
181+
typeof equalityFnOrOptions === 'function'
182+
? {}
183+
: equalityFnOrOptions
184+
const { identityFunctionCheck, stabilityCheck } = reduxContext
184185
const {
185186
identityFunctionCheck: finalIdentityFunctionCheck,
186187
stabilityCheck: finalStabilityCheck,
@@ -243,7 +244,7 @@ export function createSelectorHook(
243244
return selected
244245
},
245246
}[selector.name],
246-
[selector, stabilityCheck, devModeChecks.stabilityCheck],
247+
[selector],
247248
)
248249

249250
const selectedState = useSyncExternalStoreWithSelector(

0 commit comments

Comments
 (0)