From be0e910ef6774866e37bc521a69486ca8733390f Mon Sep 17 00:00:00 2001 From: Anton Ulyanov Date: Thu, 7 Nov 2024 17:29:34 +0300 Subject: [PATCH] StatsHouse UI: fix pack fix clear tag filter after link variable --- .../DashboardSettings/DashboardVariable.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/statshouse-ui/src/components2/Dashboard/DashboardSettings/DashboardVariable.tsx b/statshouse-ui/src/components2/Dashboard/DashboardSettings/DashboardVariable.tsx index 91ed89aa2..9a25ccef2 100644 --- a/statshouse-ui/src/components2/Dashboard/DashboardSettings/DashboardVariable.tsx +++ b/statshouse-ui/src/components2/Dashboard/DashboardSettings/DashboardVariable.tsx @@ -84,6 +84,22 @@ export function DashboardVariable() { setParams((p) => { p.variables = localVariable.variables; p.orderVariables = localVariable.orderVariables; + p.orderVariables.forEach((variabeKey) => { + p.variables[variabeKey]?.link.forEach(([plotKey, tagKey]) => { + const plot = p.plots[plotKey]; + if (plot) { + if (plot.filterIn[tagKey]) { + delete plot.filterIn[tagKey]; + } + if (plot.filterNotIn[tagKey]) { + delete plot.filterNotIn[tagKey]; + } + if (plot.groupBy.indexOf(tagKey) > -1) { + plot.groupBy = plot.groupBy.filter((tagGroup) => tagGroup !== tagKey); + } + } + }); + }); }); }, [localVariable.orderVariables, localVariable.variables, setParams]);