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: {