Skip to content

Commit

Permalink
Minor optimization: remove conditional (reduxjs#1131)
Browse files Browse the repository at this point in the history
* Minor optimization: remove conditional

The conditional in selectDerivedProps is unnecessary. The code behaves
identically now but saves about 10% of performance for that portion of
the function.

See: https://jsperf.com/conditional-vs-not

Code left in place but commented in case someone ever wants to add
something like it back for "clarity".

* Just remove the code
  • Loading branch information
ericanderson authored and timdorr committed Dec 14, 2018
1 parent 89f353b commit c984b57
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/components/connectAdvanced.js
Expand Up @@ -151,10 +151,6 @@ export default function connectAdvanced(

const nextProps = sourceSelector(state, props)

if (lastDerivedProps === nextProps) {
return lastDerivedProps
}

lastDerivedProps = nextProps
return lastDerivedProps
}
Expand Down

0 comments on commit c984b57

Please sign in to comment.