diff --git a/src/reducers/utils/__tests__/__snapshots__/index.test.js.snap b/src/reducers/utils/__tests__/__snapshots__/index.test.js.snap index f1703259..dc206e2a 100644 --- a/src/reducers/utils/__tests__/__snapshots__/index.test.js.snap +++ b/src/reducers/utils/__tests__/__snapshots__/index.test.js.snap @@ -18,6 +18,8 @@ exports[`reducers utils observeChanges shoud be the same - returns false 8`] = ` exports[`reducers utils observeChanges shoud be the same - returns false 9`] = `false`; +exports[`reducers utils observeChanges shoud be the same - returns false 10`] = `false`; + exports[`reducers utils observeChanges shoul NOT be the same - returns true 1`] = `true`; exports[`reducers utils observeChanges shoul NOT be the same - returns true 2`] = `true`; @@ -35,3 +37,5 @@ exports[`reducers utils observeChanges shoul NOT be the same - returns true 7`] exports[`reducers utils observeChanges shoul NOT be the same - returns true 8`] = `true`; exports[`reducers utils observeChanges shoul NOT be the same - returns true 9`] = `true`; + +exports[`reducers utils observeChanges shoul NOT be the same - returns true 10`] = `true`; diff --git a/src/reducers/utils/__tests__/index.test.js b/src/reducers/utils/__tests__/index.test.js index dc937181..d9d2f913 100644 --- a/src/reducers/utils/__tests__/index.test.js +++ b/src/reducers/utils/__tests__/index.test.js @@ -16,6 +16,10 @@ describe('reducers utils', () => { pervious: [], current: [], }, + { + pervious: [1, 1, 1], + current: [1, 1, 1], + }, { pervious: 'a', current: 'a', @@ -57,9 +61,13 @@ describe('reducers utils', () => { current: {}, }, { - pervious: [{}], + pervious: [{}, {}], current: [], }, + { + pervious: [1, 1, 1], + current: [1, 1], + }, { pervious: 'a', current: 'b', diff --git a/src/reducers/utils/index.js b/src/reducers/utils/index.js index d3a8e740..03662042 100644 --- a/src/reducers/utils/index.js +++ b/src/reducers/utils/index.js @@ -122,7 +122,7 @@ export const observeChanges = (prev: ?Object, current: ?Object, filter?: {[k: st // 2. one of the objects is null/undefined if (!prev || !current) return true; - const prevType = Object.prototype.toString.call(current); + const prevType = Object.prototype.toString.call(prev); const currentType = Object.prototype.toString.call(current); // 3. one of the objects has different type then other if (prevType !== currentType) return true;