generated from nhcarrigan/template
fix: NaN displayed in Sync New Content notification #125
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug Report
Description
The "Sync New Content" notification displays
NaN item(s)instead of the actual count of synced items.Example output:
Synced NaN item(s): 1 adventurer tier(s), 5 upgrade(s).Root Cause
In
apps/web/src/components/game/debugPanel.tsx, thebuildSyncNewContentMessagefunction calculates atotalviareduceover the count entries. If any count property fromSyncNewContentResultisundefined(e.g. a newly added field not yet present in the player's saved state), the arithmetic producesNaN, which then gets interpolated directly into the message string.Steps to Reproduce
NaNExpected Behaviour
The total should reflect the correct sum of all synced items (e.g.
Synced 6 item(s): 1 adventurer tier(s), 5 upgrade(s).).Suggested Fix
Guard against
undefined/NaNvalues when building the entries array, or use nullish coalescing (?? 0) on each count property before passing it into the reduce.✨ This issue was created with help from Hikari~ 🌸
hikari referenced this issue2026-03-24 12:15:40 -07:00