Skip to content

Commit

Permalink
[mendoza] Update meta when an item is moved
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr authored and rexxars committed Oct 6, 2020
1 parent 1cdf398 commit 742c0b9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/mendoza/src/incremental-patcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,17 @@ class Model<T>

arrayAppendSlice(target: ArrayContent<T>, source: Value<T>, left: number, right: number): void {
let arr = this.asArray(source)
let samePosition = arr.elements.length === left

target.elements.push(...arr.elements.slice(left, right))
target.metas.push(...arr.metas.slice(left, right))

if (samePosition) {
target.metas.push(...arr.metas.slice(left, right))
} else {
for (let i = left; i < right; i++) {
target.metas.push(this.meta)
}
}
}

stringAppendValue(target: StringContent<T>, value: Value<T>): void {
Expand Down

0 comments on commit 742c0b9

Please sign in to comment.