Fix: main dashboard edit showed all widgets (missing scope filter)
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.
This commit is contained in:
@@ -207,7 +207,12 @@ export function WidgetConfigDialog({
|
|||||||
dashboardScope,
|
dashboardScope,
|
||||||
editWidgetId,
|
editWidgetId,
|
||||||
}: Props) {
|
}: 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: services = [] } = useServiceInstances();
|
||||||
const { data: tasks = [] } = useTasks();
|
const { data: tasks = [] } = useTasks();
|
||||||
const saveWidget = useSaveWidgetInstance();
|
const saveWidget = useSaveWidgetInstance();
|
||||||
|
|||||||
Reference in New Issue
Block a user