From 22c577bf3c6b9fc037eca0e69444623dc9a2f182 Mon Sep 17 00:00:00 2001 From: Wes Date: Wed, 11 Oct 2023 10:03:34 -0700 Subject: [PATCH] feat: Adds new deployments to filters as they appear (#478) Fixes #435 https://github.com/TBD54566975/ftl/assets/51647/c79078ec-422f-44e5-a001-23056070deaf --- .../features/timeline/filters/TimelineFilterPanel.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/console/client/src/features/timeline/filters/TimelineFilterPanel.tsx b/console/client/src/features/timeline/filters/TimelineFilterPanel.tsx index e571f66d13..61ecfcf99e 100644 --- a/console/client/src/features/timeline/filters/TimelineFilterPanel.tsx +++ b/console/client/src/features/timeline/filters/TimelineFilterPanel.tsx @@ -45,12 +45,15 @@ export const TimelineFilterPanel = ({ const modules = useContext(modulesContext) const [selectedEventTypes, setSelectedEventTypes] = useState(Object.keys(EVENT_TYPES)) const [selectedModules, setSelectedModules] = useState([]) + const [previousModules, setPreviousModules] = useState([]) const [selectedLogLevel, setSelectedLogLevel] = useState(1) useEffect(() => { - if (selectedModules.length === 0) { - setSelectedModules(modules.modules.map((module) => module.deploymentName)) - } + const newModules = modules.modules.map((module) => module.deploymentName) + const addedModules = newModules.filter((name) => !previousModules.includes(name)) + + setSelectedModules((prevSelected) => [...prevSelected, ...addedModules]) + setPreviousModules(newModules) }, [modules]) useEffect(() => {