fix: render project tags as strings, not objects #34

Merged
forbes merged 1 commits from fix-33-project-tags-render into main 2026-02-08 21:23:20 +00:00
Owner

Bug

React error #31 ("Objects are not valid as a React child") when viewing an item's project tags.

Root Cause

MainTab.tsx typed itemProjects as string[] but the API endpoint GET /api/items/{pn}/projects returns Project[] (objects with {id, code, name, created_at}). When React tried to render the object directly, it threw error #31.

Fix

  • Change itemProjects state from string[] to Project[]
  • Use proj.code in rendering, key props, and remove handler
  • Fix add-project to push the Project object from allProjects
  • Fix dropdown filter to use .some() instead of .includes()

Build and type-check pass.

Closes #33

## Bug React error #31 ("Objects are not valid as a React child") when viewing an item's project tags. ## Root Cause `MainTab.tsx` typed `itemProjects` as `string[]` but the API endpoint `GET /api/items/{pn}/projects` returns `Project[]` (objects with `{id, code, name, created_at}`). When React tried to render the object directly, it threw error #31. ## Fix - Change `itemProjects` state from `string[]` to `Project[]` - Use `proj.code` in rendering, key props, and remove handler - Fix add-project to push the `Project` object from `allProjects` - Fix dropdown filter to use `.some()` instead of `.includes()` Build and type-check pass. Closes #33
forbes added 1 commit 2026-02-08 21:11:34 +00:00
The /api/items/{pn}/projects endpoint returns Project objects
({id, code, name, created_at}), but MainTab typed them as string[].
React error #31 was thrown when trying to render the object as a
child node.

Change itemProjects state from string[] to Project[] and use
proj.code in all rendering and comparison logic.

Closes #33
forbes merged commit 15e71d936e into main 2026-02-08 21:23:20 +00:00
forbes deleted branch fix-33-project-tags-render 2026-02-08 21:23:31 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#34