fix(widgets): dispatch close event before registry cleanup

Move widget:close dispatch before _widgets.delete() so handlers can
still query WidgetManager for the widget's state during the event.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 20:09:43 +02:00
parent 7cda3019c8
commit fde1fdd002
+1 -1
View File
@@ -165,8 +165,8 @@ const WidgetManager = {
const entry = this._widgets.get(id); const entry = this._widgets.get(id);
if (!entry) return; if (!entry) return;
entry.el.remove(); entry.el.remove();
this._widgets.delete(id);
this._emitter.dispatchEvent(new CustomEvent('widget:close', { detail: { id } })); this._emitter.dispatchEvent(new CustomEvent('widget:close', { detail: { id } }));
this._widgets.delete(id);
}, },
/** /**