Repository navigation
Description
What happens
A field's label is limited to 80 characters by LABEL_MAX_LENGTH, a constant private to src/schemas/slot-fields.ts (LabelSchema). The Build tab doesn't know that limit:
- No limit on the box. The field-name input in
src/components/build-wysiwyg/InlineFieldForm.tsxhas nomaxLength, andsave()only trims. The same form is used to add a field and to rename one, so both have the gap. - Sent as typed.
addFieldandupdateFieldinsrc/components/build-shared/useBuildState.tssend the label unchanged. The title and description are cut to their shared limits in the same file. The field label isn't. - A vague refusal. The field service parses with no reasons table, so the refusal has no
details.reason.saveErrorMessagefalls back toorganizer.errors.code.invalid_input: "Some values weren't accepted." - The name is lost. When adding a field,
FieldsPopovercallsonAddFieldand closes the form straight away, without waiting. When the save fails, the typed name is gone.
Every other limit the Build tab enforces comes from a shared constant that needs no zod: TITLE_MAX_LENGTH and DESCRIPTION_MAX_LENGTH in src/lib/signup-limits.ts, and MAX_CHOICES and CHOICE_MAX_LENGTH in src/schemas/slot-field-basics.ts. The label limit is the one rule kept only on the server.
Fix, in outline
- Share the constant. Move
LABEL_MAX_LENGTHtosrc/schemas/slot-field-basics.tsand export it.slot-fields.tsimports it there, as it already does the other constants. - Limit the box. Put
maxLength={LABEL_MAX_LENGTH}on the name input inInlineFieldForm. That covers both adding and renaming. - Cut as a safety net (optional). Cut the trimmed name to
LABEL_MAX_LENGTHinsave(), asupdateSignupMetadoes for the title.
Watch for
- Client bundle.
slot-field-basics.tsmust stay free of zod, because the Build tab is a client bundle with a JS budget (budgets.json). - Other readers.
src/lib/magic-compose/prompt.tsimportsLabelSchema. It must keep working, with the same limit. - No new text. The box should simply stop at 80 characters, so no catalog change is needed. If you add any visible text, it goes through
en.jsonand thetranslateskill. - Help pages. Check with the
help-pagesskill'saffected-articles.mjswhether any article describes adding a field. A length limit is unlikely to need a line there. - Overlap. Open PR Say in a moved slot's editor that its people will be emailed, and when #1079 also touches
useBuildState.ts, for something unrelated. Whichever lands second has a small merge.
Done when
- The field-name box stops at 80 characters, both when adding a field and when renaming one, and the limit comes from the same constant the schema uses.
InlineFieldForm.test.tsxhas a test that the name input'smaxLengthequalsLABEL_MAX_LENGTH, in create and edit mode.pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm testpass.
Found by the pipeline's refactor scout in the Build tab (src/components/build-shared, src/components/build-wysiwyg), at e80ce74. Checked by an independent verify agent. In a temporary vitest file, it showed that the create and update schemas refuse an 81-character label with no details.reason, that saveErrorMessage turns that into "Some values weren't accepted.", that the name input has no maxlength and passes 85 characters to onSave, and that FieldsPopover closes the form before the save returns. Then it deleted the file. https://claude.ai/code/session_016YZ9SUP8nmn81ZVY1pBuQU
Activity