mirror of https://github.com/sgoudham/carbon.git
Don't use custom history API (#485)
* Add shallowEquals check for onUpdate * Using Next.js Router instead of custom history API Fixes https://github.com/zeit/next.js/issues/4994 * Remove urlObject codemain
parent
d41f05d9c1
commit
2e945fc528
@ -0,0 +1,25 @@
|
|||||||
|
export default function shallowEquals (a, b) {
|
||||||
|
for (const i in a) {
|
||||||
|
// NaN === NaN is false in Javascript
|
||||||
|
if(isNaN(b[i]) && isNaN(a[i])) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (b[i] !== a[i]) {
|
||||||
|
console.log('DID NOT MATCH', i, a[i], b[i])
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const i in b) {
|
||||||
|
// NaN === NaN is false in Javascript
|
||||||
|
if(isNaN(b[i]) && isNaN(a[i])) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b[i] !== a[i]) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
Loading…
Reference in New Issue