Files
nofx/web/src
PorunC 0cb1f37b55 Fix: Add null safety checks to Debug Info section in frontend
Previously fixed StatCard components but missed the Debug Info section,
causing "Cannot read properties of undefined (reading 'total_pnl')" error
when account data is loading or incomplete.

Root cause:
- Frontend uses SWR with async data fetching (5s refresh interval)
- During initial load or API delays, account object may exist but fields undefined
- Previous fix (93e331a) only covered StatCard section (lines 369-384)
- Debug Info section (lines 360-362) still used direct property access

Changes:
- Add optional chaining (?.) to all account field accesses in Debug Info
- Add fallback values ('0.00') for undefined fields
- Ensures consistent null safety across all account data displays

This prevents runtime errors during data loading and API failures.

Fixes: TypeError: Cannot read properties of undefined (reading 'total_pnl')

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 20:39:28 +08:00
..