Skip to content

fix : add defensive access for freezeDate in streak freeze route #502

@tmdeveloper007

Description

@tmdeveloper007

Summary of What Needs to be Done:
The streak freeze route at src/app/api/streak/freeze/route.ts uses non-null assertion pending![0] after checking hasFreeze. While logically sound, this could throw if Supabase response structure is different than expected.

Changes that Need to be Made:

  • File: src/app/api/streak/freeze/route.ts (line 34)
  • Use defensive access: pending?.[0]?.freeze_date instead of pending![0].freeze_date

Impact that it would Provide:

  • Prevents potential runtime errors
  • Makes the code more defensive against unexpected data structures

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