From 93da21c938110800d4f536aca68ae682c28c4fd7 Mon Sep 17 00:00:00 2001 From: Guillem Arias Date: Fri, 15 May 2026 07:50:23 +0200 Subject: [PATCH] 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. --- .../controllers/goal_projection_chart_controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/controllers/goal_projection_chart_controller.js b/app/javascript/controllers/goal_projection_chart_controller.js index 41f77bea9..7d9bf14a9 100644 --- a/app/javascript/controllers/goal_projection_chart_controller.js +++ b/app/javascript/controllers/goal_projection_chart_controller.js @@ -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`;