mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-10 17:24:02 +02:00
Fix deep-equality for array properties (#4672)
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"slate": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Do not remove empty node in merge operation if it is first children in its parent.
|
|
5
.changeset/wicked-mayflies-approve.md
Normal file
5
.changeset/wicked-mayflies-approve.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix - deep-equals was always returning true when array props were equals.
|
@@ -24,7 +24,6 @@ export const isDeepEqual = (
|
|||||||
for (let i = 0; i < a.length; i++) {
|
for (let i = 0; i < a.length; i++) {
|
||||||
if (a[i] !== b[i]) return false
|
if (a[i] !== b[i]) return false
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
} else if (a !== b) {
|
} else if (a !== b) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
import { isDeepEqual } from '../../../src/utils/deep-equal'
|
||||||
|
|
||||||
|
export const input = {
|
||||||
|
objectA: {
|
||||||
|
text: 'same text',
|
||||||
|
array: ['array-content'],
|
||||||
|
bold: true,
|
||||||
|
},
|
||||||
|
objectB: {
|
||||||
|
text: 'same text',
|
||||||
|
array: ['array-content'],
|
||||||
|
bold: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const test = ({ objectA, objectB }) => {
|
||||||
|
return isDeepEqual(objectA, objectB)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const output = true
|
@@ -0,0 +1,20 @@
|
|||||||
|
import { isDeepEqual } from '../../../src/utils/deep-equal'
|
||||||
|
|
||||||
|
export const input = {
|
||||||
|
objectA: {
|
||||||
|
text: 'same text',
|
||||||
|
array: ['array-content'],
|
||||||
|
bold: true,
|
||||||
|
},
|
||||||
|
objectB: {
|
||||||
|
text: 'same text',
|
||||||
|
array: ['array-content'],
|
||||||
|
bold: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const test = ({ objectA, objectB }) => {
|
||||||
|
return isDeepEqual(objectA, objectB)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const output = false
|
Reference in New Issue
Block a user