We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 668c3d9 commit b11cf71Copy full SHA for b11cf71
2 files changed
.changeset/fix-clear-selected-block.md
@@ -0,0 +1,7 @@
1
+---
2
+"@craftile/editor": patch
3
4
+
5
+fix(editor): add guard to clearSelectedBlock to prevent unnecessary events
6
7
+Add early return in `clearSelectedBlock()` when no block is selected, preventing unnecessary event emissions and state updates.
packages/editor/src/managers/ui.ts
@@ -76,6 +76,10 @@ export class UIManager {
76
}
77
78
clearSelectedBlock(): void {
79
+ if (!this.state.selectedBlockId) {
80
+ return;
81
+ }
82
83
this.state.selectedBlockId = null;
84
this.events.emit('ui:block:clear-selection', { blockId: null });
85
0 commit comments