1
0
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:
Victor Baron
2021-11-22 17:09:51 +01:00
committed by GitHub
parent 0540fea6a8
commit 2523dc4f6e
5 changed files with 45 additions and 6 deletions

View File

@@ -1,5 +0,0 @@
---
"slate": patch
---
Do not remove empty node in merge operation if it is first children in its parent.

View File

@@ -0,0 +1,5 @@
---
'slate': minor
---
Fix - deep-equals was always returning true when array props were equals.

View File

@@ -24,7 +24,6 @@ export const isDeepEqual = (
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false
}
return true
} else if (a !== b) {
return false
}

View File

@@ -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

View File

@@ -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