fix(goals/chart): use optional chain for currency_symbol fallback

Biome lint flagged `(this.dataValue && this.dataValue.x) || fallback`
as `lint/complexity/useOptionalChain`. Same behaviour with
`this.dataValue?.x || fallback`, lint clean.
This commit is contained in:
Guillem Arias
2026-05-15 07:50:23 +02:00
parent 15c5c7783e
commit 93da21c938

View File

@@ -563,7 +563,7 @@ export default class extends Controller {
}).format(amount);
} catch {
// Same server-shipped symbol path as `_fmtMoneyShort`.
const symbol = (this.dataValue && this.dataValue.currency_symbol) || "$";
const symbol = this.dataValue?.currency_symbol || "$";
return `${symbol}${Math.round(amount).toLocaleString()}`;
}
}
@@ -573,7 +573,7 @@ export default class extends Controller {
// through Money.new(0, code).symbol so EUR/GBP/JPY/etc. render with
// the family-locale-correct glyph). Fall back to "$" if a stale
// payload reaches us mid-deploy.
const symbol = (this.dataValue && this.dataValue.currency_symbol) || "$";
const symbol = this.dataValue?.currency_symbol || "$";
const abs = Math.abs(amount);
if (abs >= 1_000_000) {
return `${symbol}${(amount / 1_000_000).toFixed(1).replace(/\.0$/, "")}M`;