fix: render project tags as strings, not objects #34
Reference in New Issue
Block a user
Delete Branch "fix-33-project-tags-render"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
React error #31 ("Objects are not valid as a React child") when viewing an item's project tags.
Root Cause
MainTab.tsxtypeditemProjectsasstring[]but the API endpointGET /api/items/{pn}/projectsreturnsProject[](objects with{id, code, name, created_at}). When React tried to render the object directly, it threw error #31.Fix
itemProjectsstate fromstring[]toProject[]proj.codein rendering, key props, and remove handlerProjectobject fromallProjects.some()instead of.includes()Build and type-check pass.
Closes #33
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