The Build tab lets a list get a 21st item or one over 60 characters, then rolls it back with a cryptic error

Đang mở
#784 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@richshaw đang làm issue này rồi.

Từ ngày 3/11/2026.

  • #789 của @richshaw — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug pipeline:building pipeline:ux

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 no maxLength, and commitNew only trims the text and checks it isn't empty.
  • onAddEnumOption in BuildWysiwyg.tsx (also used by WysiwygGroup.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.

  1. The cell shows "Dish 21" straight away.
  2. The field save is refused ("Array must contain at most 20 element(s)").
  3. The slot save behind it goes out anyway and is refused too.
  4. 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 (and MAX_CHOICES, if it isn't already) from src/schemas/slot-fields.ts and 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_CHOICES items, hide the "Add to list" footer and show a short line in its place, such as "A list holds up to 20 items."
  • 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.tsx covers Enter and blur-to-add (#656, #692). Keep those passing.
  • Help pages. Run the help-pages skill's affected-articles.mjs. If an article describes adding list items, mention the limit and update its UI list 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 EnumPicker test: 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 test pass.

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

Ngôn ngữ chính
TypeScript
Star
19
Fork
4
Merge trung bình
19 giờ 46 phút
Pull request đã merge (30 ngày)
194

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của richshaw/OpenSignup

Tất cả issue của richshaw/OpenSignup

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.