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:
+1
-1
@@ -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);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user