BUG: Guardian armor display shows stray "000" text after percentage #240

Closed
opened 2026-06-01 09:34:17 +02:00 by Anexim · 1 comment
Owner

Bug Description

In the Spire summary tab, the Next Guardian card at floor 10 displays the armor value as "Armor: 10%" followed by stray "000" text.

Steps to Reproduce

  1. Navigate to the Spire tab
  2. Look at the "Next Guardian" card at floor 10 (Ignis Prime)
  3. The armor line shows: "Armor: 10%" followed by "000"

Root Cause

The stray "000" text is likely from the fmt() function in src/lib/game/utils/formatting.ts which uses .toFixed(2) and .toFixed(1) for K/M/B formatting. The concatenated result of (5000/1000).toFixed(1) + 'K' produces values like "5.0K" where the trailing zero and formatting artifacts appear as stray text when adjacent JSX span elements don't have proper text boundaries.

Additionally, the guardian stats (HP, Shield, Barrier, Regen) sections may have conditional rendering where a value like 0 for a non-existent stat gets partially rendered before the guard condition kicks in.

Files Involved

  • src/components/game/tabs/SpireSummaryTab.tsx — Guardian stat rendering
  • src/lib/game/utils/formatting.tsfmt() function number formatting
## Bug Description In the Spire summary tab, the Next Guardian card at floor 10 displays the armor value as "Armor: 10%" followed by stray "000" text. ## Steps to Reproduce 1. Navigate to the Spire tab 2. Look at the "Next Guardian" card at floor 10 (Ignis Prime) 3. The armor line shows: "Armor: 10%" followed by "000" ## Root Cause The stray "000" text is likely from the `fmt()` function in `src/lib/game/utils/formatting.ts` which uses `.toFixed(2)` and `.toFixed(1)` for K/M/B formatting. The concatenated result of `(5000/1000).toFixed(1) + 'K'` produces values like "5.0K" where the trailing zero and formatting artifacts appear as stray text when adjacent JSX span elements don't have proper text boundaries. Additionally, the guardian stats (HP, Shield, Barrier, Regen) sections may have conditional rendering where a value like `0` for a non-existent stat gets partially rendered before the guard condition kicks in. ## Files Involved - `src/components/game/tabs/SpireSummaryTab.tsx` — Guardian stat rendering - `src/lib/game/utils/formatting.ts` — `fmt()` function number formatting
Anexim added the ai:todo label 2026-06-01 09:34:17 +02:00
n8n-gitea was assigned by Anexim 2026-06-01 09:34:17 +02:00
Anexim added this to the (deleted) project 2026-06-01 11:45:48 +02:00
Author
Owner

Fixed guardian armor display stray text. Extracted stat formatters (fmtArmor, fmtShield, fmtBarrier, fmtRegen) into helper functions that return properly isolated JSX elements. Split SpireSummaryTab.tsx into main component (123 lines) + helpers file (250 lines) to stay under 400-line limit.

✅ Fixed guardian armor display stray text. Extracted stat formatters (fmtArmor, fmtShield, fmtBarrier, fmtRegen) into helper functions that return properly isolated JSX elements. Split SpireSummaryTab.tsx into main component (123 lines) + helpers file (250 lines) to stay under 400-line limit.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#240