Skip to content

Commit

Permalink
Move NODE_ENV check up so debug checks are eliminated from prod
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Oct 28, 2023
1 parent 9f133f9 commit 9d7290f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/createSelectorCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ export function createSelectorCreator<
arguments
)

if (shouldRunInputStabilityCheck(inputStabilityCheck, firstRun)) {
if (
process.env.NODE_ENV !== 'production' &&
shouldRunInputStabilityCheck(inputStabilityCheck, firstRun)
) {
// make a second copy of the params, to check if we got the same results
const inputSelectorResultsCopy = collectInputSelectorResults(
dependencies,
Expand Down
6 changes: 2 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ export const shouldRunInputStabilityCheck = (
firstRun: boolean
) => {
return (
process.env.NODE_ENV !== 'production' &&
(inputStabilityCheck === 'always' ||
(inputStabilityCheck === 'once' && firstRun))
inputStabilityCheck === 'always' ||
(inputStabilityCheck === 'once' && firstRun)
)
}

0 comments on commit 9d7290f

Please sign in to comment.