Skip to content

Commit

Permalink
feat: Adds new deployments to filters as they appear (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesbillman authored Oct 11, 2023
1 parent 8eb60d3 commit 22c577b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ export const TimelineFilterPanel = ({
const modules = useContext(modulesContext)
const [selectedEventTypes, setSelectedEventTypes] = useState<string[]>(Object.keys(EVENT_TYPES))
const [selectedModules, setSelectedModules] = useState<string[]>([])
const [previousModules, setPreviousModules] = useState<string[]>([])
const [selectedLogLevel, setSelectedLogLevel] = useState<number>(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(() => {
Expand Down

0 comments on commit 22c577b

Please sign in to comment.