Skip to content

Validate approvals payload shape in fetchApprovals #3

Description

@royalpinto007

Problem

fetchApprovals casts the response unchecked, so malformed items ({id: null}) reach FlatList and crash keyExtractor.

Where

lib/api.ts (as { approvals?: Approval[] }, no per-item check) + app/index.tsx (keyExtractor={(i) => i.id}).

Acceptance

Add a failing test first with {approvals: [{id: null}, {title: 1}]}, expecting [] instead of garbage reaching the list. Then fix.

Note: this repo has no test runner configured yet. Setting up a minimal vitest (or equivalent) config is part of this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions