[Faculties][Basic info] increase rendering performance 1000x

This commit is contained in:
joonas-a
2026-07-14 10:43:33 +03:00
parent 26cc77e68e
commit 7ce91ca38d
@@ -152,32 +152,34 @@ export const InteractiveDataTable = ({
yearArray={yearArray}
yearIndex={yearIndex}
/>
<TableRow style={{ display: visible[yearIndex] ? '' : 'none' }}>
<TableCell colSpan={100}>
<CollapsedStackedBar
data={
columnIndex === 0
? sortedKeys
?.map(programme => dataProgrammeStats[programme]?.[yearIndex]?.slice(sliceStart) ?? null)
.filter(programme => !!programme)
: keyOrder[yearIndex]
?.map(programme => dataProgrammeStats[programme]?.[yearIndex]?.slice(sliceStart) ?? null)
.filter(programme => !!programme)
}
differenceData={Object.keys(differenceToPrevYears)?.reduce(
(yearlyObject, programme) => ({
...yearlyObject,
[programme]: differenceToPrevYears[programme][yearIndex],
}),
{}
)}
labels={columnIndex === 0 ? sortedKeys : keyOrder[yearIndex]}
longLabels={programmeNames}
names={titles?.slice(sliceStart)}
plotLinePlaces={plotLinePlaces}
/>
</TableCell>
</TableRow>
{visible[yearIndex] ? (
<TableRow>
<TableCell colSpan={100}>
<CollapsedStackedBar
data={
columnIndex === 0
? sortedKeys
?.map(programme => dataProgrammeStats[programme]?.[yearIndex]?.slice(sliceStart) ?? null)
.filter(programme => !!programme)
: keyOrder[yearIndex]
?.map(programme => dataProgrammeStats[programme]?.[yearIndex]?.slice(sliceStart) ?? null)
.filter(programme => !!programme)
}
differenceData={Object.keys(differenceToPrevYears)?.reduce(
(yearlyObject, programme) => ({
...yearlyObject,
[programme]: differenceToPrevYears[programme][yearIndex],
}),
{}
)}
labels={columnIndex === 0 ? sortedKeys : keyOrder[yearIndex]}
longLabels={programmeNames}
names={titles?.slice(sliceStart)}
plotLinePlaces={plotLinePlaces}
/>
</TableCell>
</TableRow>
) : null}
</Fragment>
))}
</TableBody>