1
0
Fork 0

fix(banking): render currency emblem inline to stop the hydration mismatch

CurrencyAmount returned a div, but callers place it inside p and span
(wallet hero balance, account cards, unit funds), which is invalid nesting:
the browser's parser closes the p early, so server and client markup differ
and React reports a hydration error on the banking pages. An inline-flex
span renders identically in all four call sites and is valid in each.
This commit is contained in:
Jason Fraley 2026-10-12 23:04:29 -04:00
parent 5765492494
commit 6be2af2f86

View file

@ -19,9 +19,12 @@ export function CurrencyAmount({
const showSymbol =
currency != null && typeof currency === "object" && isCurrencyConfig(currency) && !!currency.symbol;
return (
<div className="flex items-center gap-1.5">
// Inline-flex <span>, not <div>: callers render this inside <p>/<span>
// (wallet hero, account cards), where a block element is invalid nesting
// and triggers a hydration mismatch.
<span className="inline-flex items-center gap-1.5">
<CurrencySymbol currency={currency} />
<span>{formatAmount(value, currency, showSymbol ? { hideLabel: true } : undefined)}</span>
</div>
</span>
);
}