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: fix non-sheet renderer should not be set container (#2044)

Wenzhao Hu00b30e567c0f
diff --git a/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.ts b/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.ts
index d8b5915799..04043898ea 100644
--- a/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.ts
+++ b/examples/src/plugins/debugger/controllers/e2e/e2e-memory.controller.ts
@@ -18,8 +18,8 @@ import { IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceTyp
import { DEFAULT_WORKBOOK_DATA_DEMO } from '../../../../data/sheets/demo/default-workbook-data-demo';
-const AWAIT_LOADING_TIMEOUT = 2000;
-const AWAIT_DISPOSING_TIMEOUT = 2000;
+const AWAIT_LOADING_TIMEOUT = 5000;
+const AWAIT_DISPOSING_TIMEOUT = 5000;
export interface IE2EMemoryControllerAPI {
loadAndRelease(id: number): Promise<void>;
diff --git a/package.json b/package.json
index d14b0e8b11..fd2f27b1cc 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,7 @@
"prepare": "husky install",
"pre-commit": "lint-staged",
"dev": "turbo dev:demo",
+ "dev:e2e": "pnpm --filter univer-examples dev:e2e",
"lint:types": "turbo lint:types",
"test": "turbo test -- --passWithNoTests",
"coverage": "turbo coverage -- --passWithNoTests",
diff --git a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx b/packages/ui/src/controllers/ui/ui-desktop.controller.tsx
index 5fc28974d2..5600105d26 100644
--- a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx
+++ b/packages/ui/src/controllers/ui/ui-desktop.controller.tsx
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Disposable, LifecycleService, LifecycleStages, toDisposable } from '@univerjs/core';
+import { Disposable, IUniverInstanceService, LifecycleService, LifecycleStages, toDisposable, UniverInstanceType } from '@univerjs/core';
import { IRenderManagerService } from '@univerjs/engine-render';
import type { IDisposable } from '@wendellhu/redi';
import { Inject, Injector, Optional } from '@wendellhu/redi';
@@ -55,9 +55,10 @@ export class DesktopUIController extends Disposable implements IDesktopUIControl
readonly componentRegistered$ = this._componentRegistered$.asObservable();
constructor(
+ @IUniverInstanceService private readonly _instanceService: IUniverInstanceService,
+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
@Inject(Injector) private readonly _injector: Injector,
@Inject(LifecycleService) private readonly _lifecycleService: LifecycleService,
- @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
@Optional(ILayoutService) private readonly _layoutService?: ILayoutService
) {
super();
@@ -75,6 +76,9 @@ export class DesktopUIController extends Disposable implements IDesktopUIControl
this._renderManagerService.currentRender$.subscribe((renderId) => {
if (renderId) {
const render = this._renderManagerService.getRenderById(renderId)!;
+ const unitType = this._instanceService.getUnitType(render.unitId);
+ if (unitType !== UniverInstanceType.SHEET) return;
+
render.engine.setContainer(canvasElement);
}
});