Fixed error with compliance page

This commit is contained in:
2026-10-22 15:58:22 +02:00
parent 299d6ff4dc
commit efc63ca398
3 changed files with 38 additions and 49 deletions
@@ -114,6 +114,20 @@ export const ExecutiveDashboard: React.FC = () => {
queryFn: () => getAllIndicators(),
});
// Filtered projects according to active Programme and Sector dropdown selections
const filteredProjects = useMemo(() => {
return projects.filter((p) => {
if (selectedProgramme !== 'All' && String(p.programmeId) !== selectedProgramme) {
return false;
}
if (selectedSector !== 'All') {
const sectorLabel = getIndustrySectorLabel(p.sector);
if (sectorLabel !== selectedSector) return false;
}
return true;
});
}, [projects, selectedProgramme, selectedSector]);
const { data: projectComplianceMap = new Map<string | number, any[]>() } = useQuery({
queryKey: ['projectComplianceMap', filteredProjects.map((p) => p.id)],
queryFn: async () => {
@@ -138,20 +152,6 @@ export const ExecutiveDashboard: React.FC = () => {
queryClient.invalidateQueries();
};
// Filtered projects according to active Programme and Sector dropdown selections
const filteredProjects = useMemo(() => {
return projects.filter((p) => {
if (selectedProgramme !== 'All' && String(p.programmeId) !== selectedProgramme) {
return false;
}
if (selectedSector !== 'All') {
const sectorLabel = getIndustrySectorLabel(p.sector);
if (sectorLabel !== selectedSector) return false;
}
return true;
});
}, [projects, selectedProgramme, selectedSector]);
// Filtered risks associated with the filtered project set
const filteredRisks = useMemo(() => {
if (selectedProgramme === 'All' && selectedSector === 'All') {