Skip to content

Commit

Permalink
fix(core): move reverse() to after map()
Browse files Browse the repository at this point in the history
  • Loading branch information
ninaandal committed Sep 29, 2023
1 parent b2e1bf2 commit f204e79
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/sanity/src/core/field/diff/changes/undoChange.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {toArray} from 'rxjs/operators'
import {
isIndexSegment,
isKeyedObject,
Expand Down Expand Up @@ -56,10 +57,7 @@ export function undoChange(
.forEach((child) => undoChange(child, rootDiff, documentOperations))

patches.push(
...buildUnsetPatches(
rootDiff,
unsetChanges.reverse().map((unsetChange) => unsetChange.path),
),
...buildUnsetPatches(rootDiff, unsetChanges.map((unsetChange) => unsetChange.path).reverse()),
)
} else if (change.diff.action === 'added') {
// The reverse of an add operation is an unset -
Expand Down

0 comments on commit f204e79

Please sign in to comment.