From b25abc5f16addbd4839bb1ce4db87be9b97a3c82 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Wed, 28 Jan 2026 16:50:27 +0100 Subject: [PATCH] fix selectedMEtric presets in jobList - remove conflicting reactivity --- web/frontend/src/Jobs.root.svelte | 35 ++++++++++++++----------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/web/frontend/src/Jobs.root.svelte b/web/frontend/src/Jobs.root.svelte index 2becea35..a34e8727 100644 --- a/web/frontend/src/Jobs.root.svelte +++ b/web/frontend/src/Jobs.root.svelte @@ -52,17 +52,24 @@ let sorting = $state({ field: "startTime", type: "col", order: "DESC" }); /* Derived */ - const presetProject = $derived(filterPresets?.project ? filterPresets.project : ""); + let presetProject = $derived(filterPresets?.project ? filterPresets.project : ""); let selectedCluster = $derived(filterPresets?.cluster ? filterPresets.cluster : null); let selectedSubCluster = $derived(filterPresets?.partition ? filterPresets.partition : null); - let metrics = $derived(filterPresets.cluster - ? filterPresets.partition - ? ccconfig[`metricConfig_jobListMetrics:${filterPresets.cluster}:${filterPresets.partition}`] - : ccconfig[`metricConfig_jobListMetrics:${filterPresets.cluster}`] || ccconfig.metricConfig_jobListMetrics - : ccconfig.metricConfig_jobListMetrics - ); - let showFootprint = $derived(filterPresets.cluster - ? !!ccconfig[`jobList_showFootprint:${filterPresets.cluster}`] + let metrics = $derived.by(() => { + if (selectedCluster) { + if (selectedSubCluster) { + return ccconfig[`metricConfig_jobListMetrics:${selectedCluster}:${selectedSubCluster}`] || + ccconfig[`metricConfig_jobListMetrics:${selectedCluster}`] || + ccconfig.metricConfig_jobListMetrics + } + return ccconfig[`metricConfig_jobListMetrics:${selectedCluster}`] || + ccconfig.metricConfig_jobListMetrics + } + return ccconfig.metricConfig_jobListMetrics + }); + + let showFootprint = $derived(selectedCluster + ? !!ccconfig[`jobList_showFootprint:${selectedCluster}`] : !!ccconfig.jobList_showFootprint ); @@ -83,16 +90,6 @@ }); }); - $effect(() => { - // Load Metric-Selection for last selected cluster - metrics = selectedCluster ? ccconfig[`metricConfig_jobListMetrics:${selectedCluster}`] : ccconfig.metricConfig_jobListMetrics - }); - - $effect(() => { - // Load Metric-Selection for last selected cluster - metrics = selectedSubCluster ? ccconfig[`metricConfig_jobListMetrics:${selectedCluster}:${selectedSubCluster}`] : ccconfig[`metricConfig_jobListMetrics:${selectedCluster}`] - }); - /* On Mount */ // The filterPresets are handled by the Filters component, // so we need to wait for it to be ready before we can start a query.