Skip to content

Add null guards for nullable payment fields before formatting #2844

@coderabbitai

Description

@coderabbitai

Context

This issue was identified during review of PR #2843 but deferred to avoid scope creep.

Problem

The PaymentHistoryRecord and PaymentDetails interfaces now correctly use Nullable<number> for fields like quantity, treeCount, and Nullable<UnitTypes> for unitType to match the backend API. However, several components pass these nullable values directly to formatting utilities like getFormattedNumber without null checks, which may cause runtime issues.

Affected Areas

  • AccountRecord.tsx and other components consuming payment data
  • Formatting utilities expecting non-nullable values
  • Fields affected: quantity, treeCount, unitType

Expected Resolution

Add defensive null checks or fallback conversions before passing nullable fields to formatting functions. This ensures type safety and prevents potential runtime errors when these fields are null or undefined.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions