From a63467e1638b2e4fec57d38df29a8af3cb57145e Mon Sep 17 00:00:00 2001 From: Developer Date: Mon, 6 Jul 2026 14:09:22 +0000 Subject: [PATCH] Fix: main dashboard edit showed all widgets (missing scope filter) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WidgetConfigDialog fetched useWidgetInstances(serviceId) with no scope filter. On the main dashboard (serviceId undefined, dashboardScope='main'), this returned ALL widget instances including service-scoped ones from service overviews — so editing the main dashboard showed widgets that were never added there. Fix: pass scope='dashboard' when serviceId is empty and dashboardScope is set. This fetches only dashboard-scoped widgets (service_id IS NULL). The 'Add existing' picker (allWidgets) stays unscoped so users can still reference service widgets onto the dashboard. 128 tests pass; lint/build green. --- frontend/src/components/WidgetConfigDialog.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/WidgetConfigDialog.tsx b/frontend/src/components/WidgetConfigDialog.tsx index 574c1a3..0c6fa21 100644 --- a/frontend/src/components/WidgetConfigDialog.tsx +++ b/frontend/src/components/WidgetConfigDialog.tsx @@ -207,7 +207,12 @@ export function WidgetConfigDialog({ dashboardScope, editWidgetId, }: Props) { - const { data: instances = [] } = useWidgetInstances(serviceId); + // When editing a dashboard (no serviceId), scope to dashboard-only widgets + // (service_id IS NULL) so service-scoped widgets don't leak into the list. + const { data: instances = [] } = useWidgetInstances( + serviceId, + !serviceId && dashboardScope ? "dashboard" : undefined, + ); const { data: services = [] } = useServiceInstances(); const { data: tasks = [] } = useTasks(); const saveWidget = useSaveWidgetInstance();