From 3a340e70a9b4a5065ea2286d71c5675d29532d18 Mon Sep 17 00:00:00 2001 From: Hongtao Lye Date: Wed, 16 Oct 2024 15:05:44 +0800 Subject: [PATCH] fix: build --- packages/framework/block-std/src/gfx/controller.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/framework/block-std/src/gfx/controller.ts b/packages/framework/block-std/src/gfx/controller.ts index 6a7d9858c1ab..225fcc3e4c76 100644 --- a/packages/framework/block-std/src/gfx/controller.ts +++ b/packages/framework/block-std/src/gfx/controller.ts @@ -274,11 +274,15 @@ export class GfxController extends LifeCycleWatcher { this._disposables.dispose(); } - updateElement(element: GfxModel, props: Record): void { - if (this.surface?.hasElementById(element.id)) { - this.surface.updateElement(element.id, props); + updateElement( + element: GfxModel | string, + props: Record + ): void { + const elemId = typeof element === 'string' ? element : element.id; + if (this.surface?.hasElementById(elemId)) { + this.surface.updateElement(elemId, props); } else { - const hasBlock = this.doc.hasBlock(element.id); + const hasBlock = this.doc.hasBlock(elemId); hasBlock && this.doc.updateBlock(element as GfxBlockElementModel, props); } }