Memoize Fluent chart token resolution
This commit is contained in:
@@ -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 2–3 times per render in `BanTrendChart`, `TopCountriesPieChart`, `TopCountriesBarChart`, and `JailDistributionChart`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user