[Bug] iOS Reddit app resets boolean form fields to defaultValue when scrolled out of view

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
56/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ios, typescript
Lĩnh vực
mobile

Hướng nghiên cứu

Start by tracing how Devvit.createForm and context.ui.showForm pass boolean field state to the iOS form controls, then find where recycled cells initialize their toggle values. Compare that path with the working Android or desktop behavior. Done means a toggled value stays visible after scrolling off-screen and is submitted correctly on iOS; verify with the reproduction steps in the issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

When using Devvit.createForm (or context.ui.showForm), fields of type: "boolean" reset to their defaultValue when scrolled out of the visible viewport in the iOS Reddit app.

When a user toggles a boolean switch, scrolls down to complete the rest of the form, and taps the submit button, the reset defaultValue is submitted in the FormOnSubmitEvent.values payload rather than the user's toggled state.

Platform Comparison

  • iOS Reddit app (Bug): Toggling a boolean, scrolling it out of view, and scrolling back up shows the toggle visibly snapped back to defaultValue. Submitting sends defaultValue.
  • Android Reddit app: Works properly. Toggled state is preserved across scrolling/view recycling.
  • Desktop Web: Works properly.

Steps to Reproduce

  1. Define a form with enough fields to require scrolling on mobile, placing a type: "boolean" field with defaultValue: true at the top:
Devvit.createForm(
  {
    title: "Test Form",
    acceptLabel: "Save",
    fields: [
      {
        name: "enable_feature",
        label: "Enable Feature",
        type: "boolean",
        defaultValue: true,
      },
      { name: "field_1", label: "Option 1", type: "string" },
      { name: "field_2", label: "Option 2", type: "string" },
      { name: "field_3", label: "Option 3", type: "string" },
      { name: "field_4", label: "Option 4", type: "string" },
      { name: "field_5", label: "Option 5", type: "string" },
    ],
  },
  (event, context) => {
    console.log("Submitted values:", event.values);
  }
);
  1. Open the form on the iOS Reddit app.
  2. Toggle enable_feature from true to false.
  3. Scroll down until the enable_feature switch is completely off-screen.
  4. Either scroll back up (the toggle will have visibly snapped back to true), or tap "Save".
  5. Inspect the submitted event.values in logs.

Expected Behavior

Form field state should persist across list/cell recycling on iOS, matching Android and Desktop Web.

Observed Behavior

On iOS, event.values.enable_feature arrives as true (defaultValue). The native iOS cell recycling re-initializes the toggle control from field.defaultValue rather than reading from the active form state model.

Environment

  • Devvit version: 0.14.8
  • Client: Reddit Mobile App (iOS)
Ngôn ngữ chính
TypeScript
Star
217
Fork
89
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 reddit/devvit

Tất cả issue của reddit/devvit

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.