Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(disposeUnit): fix the issue of drawing disposeUnit (#6543)

wpxp123456bd159b05fd47
diff --git a/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.ts b/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.ts
index 5b94931b1b..87cfd0b6bb 100644
--- a/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.ts
+++ b/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.ts
@@ -25,7 +25,6 @@ import { COMPONENT_IMAGE_POPUP_MENU, ImageCropperObject, ImageResetSizeOperation
import { IRenderManagerService } from '@univerjs/engine-render';
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
import { IMessageService } from '@univerjs/ui';
-import { takeUntil } from 'rxjs';
import { RemoveSheetDrawingCommand } from '../commands/commands/remove-sheet-drawing.command';
import { EditSheetDrawingOperation } from '../commands/operations/edit-sheet-drawing.operation';
@@ -50,8 +49,8 @@ export class DrawingPopupMenuController extends RxDisposable {
}
private _init(): void {
- this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._create(workbook));
- this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._dispose(workbook));
+ this._univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => this._create(workbook));
+ this._univerInstanceService.getTypeOfUnitDisposed$<Workbook>(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => this._dispose(workbook));
this._univerInstanceService.getAllUnitsForType<Workbook>(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._create(workbook));
this._setupLoadingStatus();
@@ -81,6 +80,7 @@ export class DrawingPopupMenuController extends RxDisposable {
const unitId = workbook.getUnitId();
this._renderManagerService.removeRender(unitId);
+ this._initImagePopupMenu.delete(unitId);
}
private _create(workbook: Nullable<Workbook>) {