fix(sheets): ensure the sheet param of InsertSheetMutation are not modified by subsequent operations (#6338)

This commit is contained in:
wpxp123456
2025-12-18 17:04:25 +08:00
committed by GitHub
parent 82cf005615
commit 1f77bf43f5
@@ -19,7 +19,7 @@ import type {
IInsertSheetMutationParams,
IRemoveSheetMutationParams,
} from '../../basics/interfaces/mutation-interface';
import { CommandType, IUniverInstanceService } from '@univerjs/core';
import { cloneWorksheetData, CommandType, IUniverInstanceService } from '@univerjs/core';
/**
* Generate undo mutation of a `InsertSheetMutation`
@@ -53,6 +53,6 @@ export const InsertSheetMutation: IMutation<IInsertSheetMutationParams, boolean>
workbook.addStyles(styles);
}
return workbook.addWorksheet(sheet.id, index, sheet);
return workbook.addWorksheet(sheet.id, index, cloneWorksheetData(sheet));
},
};