Skip to content

Commit

Permalink
Merge pull request #21 from matthieu-foucault/NaN_handling
Browse files Browse the repository at this point in the history
NaN handling
  • Loading branch information
leoasis authored Oct 3, 2016
2 parents 3a2c647 + dd32c34 commit 784c966
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/trackForMutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function detectMutations(isImmutable, trackedProperty, obj, sameParentRef = fals

const sameRef = prevObj === obj;

if (sameParentRef && !sameRef) {
if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
return { wasMutated: true, path };
}

Expand Down
4 changes: 4 additions & 0 deletions test/trackForMutations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ describe('trackForMutations', () => {
fn: (s) => {
return {...s, foo: {}};
}
},
'having a NaN in the state': {
getState: () => ({ a:NaN, b: Number.NaN }),
fn: (s) => s
}
};

Expand Down

0 comments on commit 784c966

Please sign in to comment.