From 6390a177b479d5f4310a22fe3ed9b7c9e99cfd0c Mon Sep 17 00:00:00 2001 From: Hongtao Lye Date: Tue, 17 Dec 2024 17:57:57 +0800 Subject: [PATCH] fix: initialize --- packages/affine/block-surface/src/view/mindmap.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/affine/block-surface/src/view/mindmap.ts b/packages/affine/block-surface/src/view/mindmap.ts index 876befb077f1..9340c1380fa9 100644 --- a/packages/affine/block-surface/src/view/mindmap.ts +++ b/packages/affine/block-surface/src/view/mindmap.ts @@ -26,6 +26,10 @@ export class MindMapView extends GfxElementModelView { private _initCollapseButtons() { const updateButtons = requestThrottledConnectedFrame(() => { + if (!this.isConnected) { + return; + } + const visited = new Set(); this.model.traverse(node => { @@ -63,6 +67,8 @@ export class MindMapView extends GfxElementModelView { this.disposable.add(() => { this.model.children.unobserve(updateButtons); }); + + updateButtons(); } private _needToUpdateButtonStyle(options: {