Skip to content

Commit

Permalink
fix: don't inadvertendly call getters
Browse files Browse the repository at this point in the history
  • Loading branch information
phyllisstein committed Aug 31, 2018
1 parent 151e4e4 commit 322e746
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/reconciler/hotReplacementRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,16 @@ const equalClasses = (a, b) => {
let misses = 0
let comparisons = 0
Object.getOwnPropertyNames(prototypeA).forEach(key => {
if (typeof prototypeA[key] === 'function' && key !== 'constructor') {
const descriptorA = Object.getOwnPropertyDescriptor(prototypeA, key)
const valueA =
descriptorA && (descriptorA.value || descriptorA.get || descriptorA.set)
const descriptorB = Object.getOwnPropertyDescriptor(prototypeB, key)
const valueB =
descriptorB && (descriptorB.value || descriptorB.get || descriptorB.set)

if (typeof valueA === 'function' && key !== 'constructor') {
comparisons++
if (
haveTextSimilarity(String(prototypeA[key]), String(prototypeB[key]))
) {
if (haveTextSimilarity(String(valueA), String(valueB))) {
hits++
} else {
misses++
Expand Down

0 comments on commit 322e746

Please sign in to comment.