lib0 1.0.0-rc.18 → 1.0.0-rc.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/delta/delta.js +7 -2
package/package.json
CHANGED
package/src/delta/delta.js
CHANGED
|
@@ -2726,7 +2726,9 @@ const applyDim = (op, field, update) => {
|
|
|
2726
2726
|
*/
|
|
2727
2727
|
const diffDim = (aVal, bVal, deep) => {
|
|
2728
2728
|
if (fun.equalityDeep(aVal, bVal)) return undefined
|
|
2729
|
-
if (bVal === null || bVal === undefined || object.isEmpty(bVal))
|
|
2729
|
+
if ((bVal === null || bVal === undefined || object.isEmpty(bVal)) && (deep || aVal == null)) {
|
|
2730
|
+
return null // fully cleared: attribution (`deep`) clears wholesale; format with no prior keys has nothing to enumerate
|
|
2731
|
+
}
|
|
2730
2732
|
/** @type {{[k:string]:any}} */
|
|
2731
2733
|
const u = {}
|
|
2732
2734
|
for (const k in bVal) {
|
|
@@ -2737,7 +2739,10 @@ const diffDim = (aVal, bVal, deep) => {
|
|
|
2737
2739
|
: bVal[k]
|
|
2738
2740
|
}
|
|
2739
2741
|
}
|
|
2740
|
-
|
|
2742
|
+
// removed keys. For `format` (shallow) a full clear enumerates one `{k:null}` per prior key instead of a
|
|
2743
|
+
// wholesale `format:null` — individual clears rebase without clobbering concurrently-added formats.
|
|
2744
|
+
// (`for..in` is a no-op when `aVal` is nullish; `k in bVal` is guarded against a nullish `bVal`.)
|
|
2745
|
+
for (const k in aVal) { if (bVal == null || !(k in bVal)) u[k] = null }
|
|
2741
2746
|
return u
|
|
2742
2747
|
}
|
|
2743
2748
|
|