Skip to content

Commit b439c15

Browse files
committed
fix: optimize save() to avoid duplicate syncToSingleFileWorkbook calls
1 parent cdfd574 commit b439c15

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/drivers/excel/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,12 @@ export class ExcelDriver extends MemoryDriver {
556556
*/
557557
async save(): Promise<void> {
558558
if (this.fileStorageMode === 'single-file') {
559-
// Sync all objects to single file
559+
// Sync all objects to single file (collect unique object names first)
560+
const objectNames = new Set<string>();
560561
for (const [key] of this.store.entries()) {
561-
const objectName = key.split(':')[0];
562+
objectNames.add(key.split(':')[0]);
563+
}
564+
for (const objectName of objectNames) {
562565
await this.syncToSingleFileWorkbook(objectName);
563566
}
564567
await this.saveWorkbook();

0 commit comments

Comments
 (0)