diff --git a/frontend/src/components/WidgetConfigDialog.tsx b/frontend/src/components/WidgetConfigDialog.tsx index 04d0d1c..90b8a66 100644 --- a/frontend/src/components/WidgetConfigDialog.tsx +++ b/frontend/src/components/WidgetConfigDialog.tsx @@ -235,13 +235,15 @@ export function WidgetConfigDialog({ // When editWidgetId is set and the dialog opens, auto-enter edit mode for // that widget (instead of showing the list view). useEffect(() => { - if (open && editWidgetId && instances.length > 0) { - const target = instances.find((w) => w.id === editWidgetId); + if (open && editWidgetId) { + // Search both owned widgets and referenced widgets. + const target = instances.find((w) => w.id === editWidgetId) + ?? references.find((r) => r.widget.id === editWidgetId)?.widget; if (target) { startEdit(target); } } - }, [open, editWidgetId, instances]); + }, [open, editWidgetId, instances, references]); function startAddBuiltIn(kind: string) { const binding = BUILTIN_WIDGETS[kind];