Form inputs do not display associated list of errors

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

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

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Tái hiện vấn đề trong CodeSandbox được liên kết, bắt đầu với src/dataProvider.tsx và hook useSubmit tùy chỉnh. Sau đó kiểm tra packages/ra-core/src/form/setSubmissionErrors.ts và thêm bài kiểm thử hồi quy được đề cập trong issue. Hoàn tất khi nhiều lỗi API cho một trường được hiển thị, bao gồm cả lỗi bằng tiếng Pháp và tiếng Anh.

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

Mô tả

What you were expecting:

I would see two error texts below the input concerned by the error

What happened instead:

The input is actually red, showing there is an error, but not displaying the text provided by the API

Steps to reproduce:

  • Go to this sandbox: https://codesandbox.io/s/broken-voice-dd8zth
  • On the Tag page, try creating a tag (with french and english labels). Save.
  • You should see the french error displaying correctly on the field while the english errors are not displaying

Related code:

Sanbox https://codesandbox.io/s/broken-voice-dd8zth?file=/src/dataProvider.tsx
I created a custom useSubmit hook whose purpose is to display errors associated to the fields concerned by the error

Other information:

From my investigation, the bug comes from the way setSubmissionErrors sets the error.
I'll try creating a merge request and adding a test to handle lists of errors associated to a field

Environment

  • React-admin version: 4.4.3
  • Last version that did not exhibit the issue (if applicable): N/A
  • React version: 17
  • Browser: Google Chrome: Version 106.0.5249.119 (Build officiel) (x86_64)
  • Stack trace (in case of a JS error): N/A
Ngôn ngữ chính
TypeScript
Star
27k
Fork
5.5k
Merge trung bình
1 ngày 3 phút
Pull request đã merge (30 ngày)
32

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 marmelab/react-admin

Tất cả issue của marmelab/react-admin

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.