The Build tab lets a list get a 21st item or one over 60 characters, then rolls it back with a cryptic error
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
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
- 主要语言
- TypeScript
- 星标
- 19
- 派生
- 4
- 平均合并
- 19 小时 27 分钟
- 30 天内合并 PR
- 199
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
richshaw/OpenSignup 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 74/100
richshaw/OpenSignup#794 ·
维护者通常 1 天内回复
-
enhancement pipeline:proposed pipeline:ux
难度 2/5 1-3 小时 新手友好度 72/100
richshaw/OpenSignup#654 ·
维护者通常 1 天内回复
-
Slot times are shown with their own copy of the HH:MM rule that saving them checks可能已有人在做 @novakzx 今天认领。 未关闭enhancement good first issue pipeline:ready
难度 2/5 1-3 小时 新手友好度 25/100
richshaw/OpenSignup#805 ·
维护者通常 1 天内回复
-
The sign-up dialog decides "See alternatives" with its own copy of the rule behind "Pick another slot."可能已有人在做 @dafeiyupola 今天认领。 未关闭enhancement good first issue pipeline:ready
难度 2/5 1-3 小时 新手友好度 25/100
richshaw/OpenSignup#803 ·
维护者通常 1 天内回复
-
A failed database query logs its parameters, so OAuth tokens and participant details can end up in the logs可能已有人在做 @richshaw 于 1 天前认领。 未关闭bug pipeline:building
richshaw/OpenSignup#800 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 richshaw/OpenSignup 的全部 Issue
相似的 Issue
-
bug needs-triage potential-regression
难度 2/5 1-3 小时 新手友好度 78/100
aws/aws-sdk-js-v3#8408 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
colinhacks/zod#6743 ·
维护者通常 1 天内回复
-
[BUG] Packing list: the weight field drops digits on a slow connection and saves the wrong weight未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
openai/openai-node#3124 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
anthropics/anthropic-sdk-typescript#1296 ·
维护者通常 8 天内回复