The Build tab lets a list get a 21st item or one over 60 characters, then rolls it back with a cryptic error
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
What happens
A List field allows at most MAX_CHOICES (20) items, each at most CHOICE_MAX_LENGTH (60) characters (ChoiceSchema and the enum config in src/schemas/slot-fields.ts). The Build tab's list picker doesn't enforce either limit:
EnumPicker(src/components/build-wysiwyg/EnumPicker.tsx): "Add to list" is always shown, the "New option name" input has nomaxLength, andcommitNewonly trims the text and checks it isn't empty.onAddEnumOptioninBuildWysiwyg.tsx(also used byWysiwygGroup.tsx) skips duplicates only, and sends[...choices, value]with no count check.
Example: an organizer running a potluck with 20 dishes types "Dish 21" and adds it.
- The cell shows "Dish 21" straight away.
- The field save is refused ("Array must contain at most 20 element(s)").
- The slot save behind it goes out anyway and is refused too.
- The cell rolls back.
What stays on the save rail is the slot refusal, "dish" must be one of: Dish 1, Dish 2, … Dish 20. Nothing says a list holds 20 items. A 61-character item goes the same way.
sanitizeEnumChoices caps the list at 20, but only when a field is first created.
Fix, in outline
- Export
CHOICE_MAX_LENGTH(andMAX_CHOICES, if it isn't already) fromsrc/schemas/slot-fields.tsand import them on the client. Don't type the numbers. - In
EnumPicker:- put
maxLength={CHOICE_MAX_LENGTH}on the new-item input; - when the list already has
MAX_CHOICESitems, hide the "Add to list" footer and show a short line in its place, such as "A list holds up to 20 items."
- put
- In
onAddEnumOption, return early at the cap as a backstop.
Watch for
- Both pickers. The slot editor and the group header use the same component and handler. Check both.
- Existing tests.
BuildWysiwyg.test.tsxcovers Enter and blur-to-add (#656, #692). Keep those passing. - Help pages. Run the
help-pagesskill'saffected-articles.mjs. If an article describes adding list items, mention the limit and update itsUIlist if a control's name changes. - Out of scope: the slot save still runs after a failed field save. That's a separate change.
Done when
- An
EnumPickertest: with 20 options, there is no "Add to list" and the limit line shows. With 19, "Add to list" is there. - A test that the new-item input caps at 60 characters.
pnpm lint && pnpm typecheck && pnpm knip && pnpm testpass.
Found by the pipeline's bugs scout in the Build tab's list picker (src/components/build-wysiwyg), at 8e63fab. Checked by an independent verifier with a scratch component test: "Add to list" stayed enabled at 20 items, both saves were refused, and the rail ended on the "must be one of" message. https://claude.ai/code/session_016YZ9SUw2vvaNxfSUsArR5B
- Lingua principale
- TypeScript
- Stelle
- 19
- Fork
- 4
- Merge medio
- 19h 46m
- PR unite (30g)
- 194
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di richshaw/OpenSignup
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
richshaw/OpenSignup#794 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement pipeline:proposed pipeline:ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
richshaw/OpenSignup#654 ·
I maintainer di solito rispondono entro 1 giorno
-
Two breadcrumb pages belong to URLs that always redirect, so they never showForse già presa @richshaw l’ha presa 1 giorno fa. Apertaenhancement good first issue pipeline:stuck
richshaw/OpenSignup#793 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
A failed "Turn reminders back on" reloads the page with no errorForse già presa @ShahadatTest l’ha presa 1 giorno fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
richshaw/OpenSignup#785 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug pipeline:proposed pipeline:ux
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
richshaw/OpenSignup#783 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di richshaw/OpenSignup
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 2 giorni
-
reproduced
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
anomalyco/opencode#62052 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
strapi/design-system#2084 ·
I maintainer di solito rispondono entro 3 giorni
-
Report: &TV InternationalApertacheck:passed streams:remove
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
OAuth documentation for GET /api/v2/users/me/ appears inconsistent with required global read scopeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno