Add React.memo to heavy dashboard components

This commit is contained in:
2026-04-20 20:00:59 +02:00
parent 1d6564aa32
commit 1694ac17f8
7 changed files with 58 additions and 18 deletions

View File

@@ -3,7 +3,7 @@
* an "Other" slice aggregating all remaining countries.
*/
import { useMemo } from "react";
import { memo, useMemo } from "react";
import {
Cell,
Legend,
@@ -129,7 +129,7 @@ function PieTooltip(props: TooltipContentProps): React.JSX.Element | null {
* @param props - `countries` map and `countryNames` map from the
* `/api/dashboard/bans/by-country` response.
*/
export function TopCountriesPieChart({
export const TopCountriesPieChart = memo(function TopCountriesPieChart({
countries,
countryNames,
}: TopCountriesPieChartProps): React.JSX.Element {
@@ -194,4 +194,4 @@ export function TopCountriesPieChart({
</ResponsiveContainer>
</div>
);
}
});