Skip to content

Commit 894257f

Browse files
TokenBriceclaude
andcommitted
fix(reserve-treemap): suppress ghost "0%" from Recharts root node
Recharts Treemap renders the synthetic root node (depth=0) via the content prop, which has no user data and defaults to pct=0. The root's "0%" text appeared at the container center and bled through the semi-transparent (opacity=0.6) child rects — visually attaching to whichever cell covered the center (sDAI in GHO's layout). Fix: return an empty <g /> for depth=0 to skip root rendering. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 45f80e2 commit 894257f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/reserve-treemap.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function TreemapCell({
2929
name,
3030
risk,
3131
pct,
32+
depth,
3233
}: {
3334
x: number;
3435
y: number;
@@ -37,7 +38,11 @@ function TreemapCell({
3738
name: string;
3839
risk: ReserveRisk;
3940
pct: number;
41+
depth?: number;
4042
}) {
43+
// Recharts renders the synthetic root node (depth=0) via content too — skip it
44+
if (depth === 0) return <g />;
45+
4146
const fill = RISK_COLORS[risk];
4247
const showLabel = width > 50 && height > 30;
4348
const showPct = showLabel && width > 40 && height > 40;
@@ -139,7 +144,7 @@ export function ReserveTreemap({ reserves }: ReserveTreemapProps) {
139144
data={data}
140145
dataKey="size"
141146
nameKey="name"
142-
content={<TreemapCell x={0} y={0} width={0} height={0} name="" risk="low" pct={0} />}
147+
content={<TreemapCell x={0} y={0} width={0} height={0} name="" risk="low" pct={0} depth={1} />}
143148
isAnimationActive={false}
144149
>
145150
<Tooltip content={<ReserveTooltip />} />

0 commit comments

Comments
 (0)