Skip to content

fix: define missing showBoth variable in Balance component - #497

Merged
Kukks merged 1 commit into
masterfrom
fix/balance-showBoth-reference
Mar 30, 2026
Merged

Kukks merged 1 commit into
masterfrom
fix/balance-showBoth-reference

Conversation

@Kukks

@Kukks Kukks commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fixes ReferenceError: showBoth is not defined introduced by feat(settings): default currency display to fiat only #473
  • showBoth was used in the JSX margin expression but never defined
  • Defines it as config.currencyDisplay === CurrencyDisplay.Both and reuses it for the conditional render block on line 63 (which had the same expression duplicated)

Test plan

  • Verify Balance component renders without errors on all currency display modes (Sats, Fiat, Both)
  • Verify the margin changes correctly when "Both" display is active

Summary by CodeRabbit

  • Refactor
    • Optimized internal code structure for improved maintainability and clarity.

showBoth was referenced on line 34 but never defined, causing a
ReferenceError at runtime after merging #473. Define it from
config.currencyDisplay and reuse it for the conditional render.
@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c9abd0d1-d9d4-43d5-ae4e-03d8a59c393d

📥 Commits

Reviewing files that changed from the base of the PR and between 9380d68 and 513a4f8.

📒 Files selected for processing (1)
  • src/components/Balance.tsx

Walkthrough

Extracted a local boolean variable showBoth in the Balance component to replace an inline conditional check for config.currencyDisplay === CurrencyDisplay.Both. This simplifies the JSX rendering logic by deriving the boolean upfront rather than re-evaluating the condition at the point of use.

Changes

Cohort / File(s) Summary
Balance Component Refactoring
src/components/Balance.tsx
Introduced local showBoth boolean derived from currency display configuration; replaced inline conditional check with the derived variable in JSX rendering of secondary balance.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • bordalix
  • pietro909
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: defining the missing showBoth variable in the Balance component, which aligns with the PR's primary objective of resolving a ReferenceError.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/balance-showBoth-reference

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghost

ghost commented Mar 30, 2026

Copy link
Copy Markdown

Review — Arkana 🔍

Clean fix. showBoth was referenced in the JSX margin expression (introduced in #473) but never declared — this defines it and deduplicates the config.currencyDisplay === CurrencyDisplay.Both check on line 63.

✅ Correct derivation from config.currencyDisplay
✅ Reduces duplication (the conditional render block now uses the same variable)
✅ No behavioral change — strictly a bugfix

LGTM.

@Kukks
Kukks merged commit dc9396c into master Mar 30, 2026
4 of 5 checks passed
@Kukks
Kukks deleted the fix/balance-showBoth-reference branch March 30, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant