Input components have their value prop overwritten in form context if it is nil
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Elixir
- スター
- 2.1k
- フォーク
- 146
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
surface-ui/surface のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
surface-ui/surface#634 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
surface-ui/surface#770 ·
-
Website is downオープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
surface-ui/surface#768 · コメント 4 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
surface-ui/surface#762 · コメント 2 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
surface-ui/surface#759 · リアクション 1 件 ·
surface-ui/surface の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
expert-lsp/expert#942 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
carverauto/serviceradar#5756 ·
メンテナーはふだん 1 日以内に返信
-
Markdown preview can show an outdated version of the cell source対応中かも @RaphaelFakhri が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
livebook-dev/livebook#3228 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 93/100
TomerAberbach/profiler-md#732 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
inertiajs/inertia-phoenix#84 ·