Skip to content
Snippets Groups Projects
Commit bad01cae authored by Remco Tukker's avatar Remco Tukker
Browse files

fix some linter warnings

parent c9fa71e4
No related branches found
No related tags found
1 merge request!2Feature/comp 116 initial filter mechanism
This diff is collapsed.
......@@ -119,16 +119,17 @@ function FundingSourcePage({ filterSelection, setFilterSelection }: inputProps)
setFundingSourceData(_fundingData)
// filter fallback for when nothing is selected (only last year for all nrens)
const visibleYears = filterSelection.selectedYears.filter(year => years.has(year));
const newSelectedYears = visibleYears.length ? filterSelection.selectedYears : [Math.max(...years)];
const visibleNrens = filterSelection.selectedNrens.filter(nren => nrens.has(nren));
const newSelectedNrens = visibleNrens.length ? filterSelection.selectedNrens : [...nrens];
// this will also cause the selected data to be rendered:
setFilterSelection({selectedYears: newSelectedYears, selectedNrens: newSelectedNrens});
setFilterSelection(previous => {
const visibleYears = previous.selectedYears.filter(year => years.has(year));
const newSelectedYears = visibleYears.length ? previous.selectedYears : [Math.max(...years)];
const visibleNrens = previous.selectedNrens.filter(nren => nrens.has(nren));
const newSelectedNrens = visibleNrens.length ? previous.selectedNrens : [...nrens];
return { selectedYears: newSelectedYears, selectedNrens: newSelectedNrens };
});
}
loadData()
}, [])
}, [setFilterSelection])
useEffect(() => {
if (fundingSourceData === undefined) {
......@@ -152,7 +153,7 @@ function FundingSourcePage({ filterSelection, setFilterSelection }: inputProps)
freshDataset.labels = freshDataset.labels.filter((e) => filterSelection.selectedNrens.includes(e));
setDataset(freshDataset);
}, [filterSelection])
}, [fundingSourceData, filterSelection])
return (
<Container>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment