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:
@@ -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)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user