Input components have their value prop overwritten in form context if it is nil
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
- 45/100
Hướng nghiên cứu
Start with Surface.Components.Form.HiddenInput and the Form/Field handling shown in the reproduction, then run the nested MyComponent example against a changeset. Trace how a nil value prop is resolved in the form context; done means an explicit nil remains effective instead of being replaced by the matching changeset value.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Suppose you've got a component that uses a Surface input component:
defmodule MyComponent do
use Surface.LiveComponent
data value, :string, default: nil
def render(assigns) do
~F"""
<Surface.Components.Form.HiddenInput value={@value} />
"""
end
end
Now, if the component is used inside a Surface form context with the form having a changeset, as here:
defmodule MyForm do
Surface.LiveComponent
data changeset, :changeset, (some changeset value)
def render(assigns)
~F"""
<Form for={@changeset}>
<Field name="my_field">
<MyComponent />
</Field>
</Form>
"""
end
end
Then the changeset's value always overrides the nested matching form field value in case if the data 'value' field managed by the stateful component of MyComponent is nil.
The behavior you expected
I should be able to set value prop of the input component explicitely as nil.
Your Environment
Surface: v0.7.4
LiveView: v0.17.10
Elixir: v1.13.4
- Ngôn ngữ chính
- Elixir
- Star
- 2.1k
- Fork
- 146
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của surface-ui/surface
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
surface-ui/surface#634 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
surface-ui/surface#770 ·
-
Website is downĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
surface-ui/surface#768 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
surface-ui/surface#762 · 2 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
surface-ui/surface#759 · 1 reaction ·
Tất cả issue của surface-ui/surface
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
electric-sql/electric#4830 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Gradle release-date fallback accepts `Last-Modified` from non-2xx responses, so `cooldown` lets brand-new plugin versions throughCó thể đã có người làm @v-robaiken đã nhận hôm nay. Đang mởL: java:gradle T: bug 🐞
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
dependabot/dependabot-core#16547 · 1 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
github_actions
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
team-alembic/clarity#146 ·