library: enforce 21-object-per-shelf cap in the UI#150
Conversation
Surface the backend's per-shelf object limit: catch the 400 on object create, edit (shelf change), and move, mapping the "shelf cannot have more than 21 objects" message to friendly copy. Pre-disable the Add control and show a counter once a shelf is full, with the backend remaining the source of truth. Bundles related library refinements: CharCount atom, AudioCard, ReorderGrid, AddShelfModal, and addObjectSchema field limits. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@claude , review this PR. |
|
Claude finished @MaryWylde's task in 3m 10s —— View job PR Review: library — enforce 21-object-per-shelf cap in the UITasks
The approach is sound — Issues
const SHELF_NAME_MAX_LENGTH = 100;This PR added it to Empty-shelf "Add" button not guarded
<Button
onClick={openAdd} // ← no disabled prop
type={ButtonType.Secondary}
Icon={<PlusIcon />}
ariaLabel={`Add ${typeLabel}`}
/>Today this is safe —
Minor observations (not blocking)
Positives
Verdict: Two small fixes before merge — the |
Dedupe SHELF_NAME_MAX_LENGTH into common.ts (was a second local copy in Shelf and AddShelfModal), guard the empty-shelf Add button with the same atObjectLimit check as the header button, and drop a redundant text-align: left from CharCount. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Surface the backend's per-shelf object limit: catch the 400 on object create, edit (shelf change), and move, mapping the "shelf cannot have more than 21 objects" message to friendly copy. Pre-disable the Add control and show a counter once a shelf is full, with the backend remaining the source of truth.
Bundles related library refinements: CharCount atom, AudioCard, ReorderGrid, AddShelfModal, and addObjectSchema field limits.