Skip to content

fix(ui): support both array and object recommend API responses - #64

Merged
chake111 merged 1 commit into
mainfrom
codex/update-json-parsing-in-search-method
Apr 20, 2026
Merged

chake111 merged 1 commit into
mainfrom
codex/update-json-parsing-in-search-method

Conversation

@chake111

Copy link
Copy Markdown
Owner

Motivation

  • The recommend API may return either a raw array or a legacy object containing a recommendations array, so the search parser must handle both shapes to avoid runtime failures.

Description

  • Updated ui/hooks/use-search-flow.ts to read the raw payload via await response.json() cast as RecommendItem[] | { recommendations?: RecommendItem[] } and normalize a recommendations array by branching on Array.isArray(payload) or Array.isArray(payload?.recommendations), then map that normalized array into the existing normalized results while keeping filtering, sorting, pagination, and telemetry behavior unchanged.

Testing

  • Ran npm run typecheck in ui/ and the TypeScript check completed successfully.

Codex Task

@vercel

vercel Bot commented Apr 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-tool-picker Ready Ready Preview, Comment Apr 20, 2026 1:56pm

@chake111
chake111 merged commit 6b9e92b into main Apr 20, 2026
2 of 3 checks passed

This branch was successfully deployed

1 active deployment
Preview b60a5991 Deployed Apr 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant