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(doc): error in console (#770)

Ran Luo87da9423bf0e
diff --git a/packages/docs/src/controllers/page-render.controller.ts b/packages/docs/src/controllers/page-render.controller.ts
index 34150361c3..440338466b 100644
--- a/packages/docs/src/controllers/page-render.controller.ts
+++ b/packages/docs/src/controllers/page-render.controller.ts
@@ -18,11 +18,13 @@ import {
Disposable,
DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
+ IUniverInstanceService,
LifecycleStages,
OnLifecycle,
} from '@univerjs/core';
import type { Documents, IPageRenderConfig } from '@univerjs/engine-render';
import { IRenderManagerService, Rect } from '@univerjs/engine-render';
+import { Inject } from '@wendellhu/redi';
const PAGE_STROKE_COLOR = 'rgba(198,198,198, 1)';
@@ -30,7 +32,10 @@ const PAGE_FILL_COLOR = 'rgba(255,255,255, 1)';
@OnLifecycle(LifecycleStages.Rendered, PageRenderController)
export class PageRenderController extends Disposable {
- constructor(@IRenderManagerService private readonly _renderManagerService: IRenderManagerService) {
+ constructor(
+ @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
+ @Inject(IUniverInstanceService) private readonly _currentUniverService: IUniverInstanceService
+ ) {
super();
this._initialize();
@@ -48,6 +53,10 @@ export class PageRenderController extends Disposable {
return;
}
+ if (this._currentUniverService.getUniverDocInstance(unitId) == null) {
+ return;
+ }
+
const currentRender = this._renderManagerService.getRenderById(unitId);
if (currentRender == null) {