Memoize Fluent chart token resolution

This commit is contained in:
2026-04-20 19:47:10 +02:00
parent 20412dd94b
commit 27369b43d6
9 changed files with 140 additions and 18 deletions

View File

@@ -168,7 +168,11 @@ Issues are grouped by category and ordered roughly by severity. Each entry descr
---
### TASK-009 — `resolveFluentToken` calls `getComputedStyle` on every render
### TASK-009 — `resolveFluentToken` calls `getComputedStyle` on every render (done)
**Where fixed:** `frontend/src/components/BanTrendChart.tsx`, `frontend/src/components/TopCountriesPieChart.tsx`, `frontend/src/components/TopCountriesBarChart.tsx`, `frontend/src/components/JailDistributionChart.tsx`
**Summary:** Wrapped Fluent token resolution calls in `useMemo([])` in each chart component and added tests verifying token resolution is memoized across rerenders.
**Where found:** `frontend/src/utils/chartTheme.ts`, `resolveFluentToken` function. Called 23 times per render in `BanTrendChart`, `TopCountriesPieChart`, `TopCountriesBarChart`, and `JailDistributionChart`.