Skip to content

[BUG] Charts Crash When yearlyResults Is Empty or Undefined #2

@TopBeijing

Description

@TopBeijing

Both NetWorthChart and CashOutflowChart components assume that results.yearlyResults is always a non-empty array. If projectionYears is set to 0 or a negative value (e.g., via URL or direct state manipulation), or if calculation logic fails, yearlyResults can be empty. This causes runtime errors (e.g., .map on undefined or empty arrays) and chart rendering failures.

Steps to Reproduce

  1. Set projectionYears to 0 or a negative value (e.g., via URL or programmatically).
  2. Observe that the charts fail to render and may throw runtime errors.

Expected Behavior

Charts should gracefully handle empty or undefined data, displaying a user-friendly message instead of crashing.

Suggested Fix

Add runtime guards in both chart components to check for empty or undefined yearlyResults and render a fallback UI when no data is available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions