From b17dac2201a4bc067d9638ca00a0dc6b32343a8f Mon Sep 17 00:00:00 2001 From: Saul-Mirone Date: Fri, 3 Jan 2025 10:09:01 +0000 Subject: [PATCH] fix(editor): block selection error when unloaded (#9511) Closes: [BS-2305](https://linear.app/affine-design/issue/BS-2305/typeerror-thisblock-is-null) --- blocksuite/affine/components/src/block-selection/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/blocksuite/affine/components/src/block-selection/index.ts b/blocksuite/affine/components/src/block-selection/index.ts index 975b76027..b0715a433 100644 --- a/blocksuite/affine/components/src/block-selection/index.ts +++ b/blocksuite/affine/components/src/block-selection/index.ts @@ -54,7 +54,9 @@ export class BlockSelection extends SignalWatcher(LitElement) { protected override updated(_changedProperties: PropertyValues): void { super.updated(_changedProperties); - this.style.display = this.block.selected?.is('block') ? 'block' : 'none'; + if (this.block) { + this.style.display = this.block.selected?.is('block') ? 'block' : 'none'; + } } @property({ attribute: false })