Skip to content

Commit d09bfe2

Browse files
luoxuanzaoQoder-AI
andcommitted
perf(chat): skip the redundant drop-overlay class write
dragenter fires for every child element under the pointer, and Obsidian's class helpers rewrite the attribute even when the value is unchanged. Co-authored-by: QoderAI (Qwen 3.8 Max) <qoder_ai@qoder.com>
1 parent a94bdd9 commit d09bfe2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/features/chat/ui/vault-drop.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ export class VaultDropController {
128128
if (!this.hasClaimableDrag(event)) return;
129129
event.preventDefault();
130130
event.stopImmediatePropagation();
131-
this.dropOverlayEl.addClass('visible');
131+
// dragenter fires again for every child element; skip the redundant write.
132+
if (!this.dropOverlayEl.hasClass('visible')) {
133+
this.dropOverlayEl.addClass('visible');
134+
}
132135
};
133136

134137
private readonly handleDragOver = (event: DragEvent): void => {

0 commit comments

Comments
 (0)