Fix group rotation (#1058)

* Update history.js
- Change `BatchCommand.unapply` to use `[...this.commands].reverse()` so the original array is never mutated.
- This preserves the order of commands and ensures history integrity.
This commit is contained in:
JFH
2025-06-09 00:33:39 +08:00
committed by GitHub
parent c127c3734b
commit 887ad2e39f

View File

@@ -425,7 +425,7 @@ export class BatchCommand extends Command {
*/ */
unapply (handler) { unapply (handler) {
super.unapply(handler, () => { super.unapply(handler, () => {
this.stack.reverse().forEach((stackItem) => { [...this.stack].reverse().forEach((stackItem) => {
console.assert(stackItem, 'stack item should not be null') console.assert(stackItem, 'stack item should not be null')
stackItem && stackItem.unapply(handler) stackItem && stackItem.unapply(handler)
}) })