You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Describe the bug
Suppose you've got a component that uses a Surface input component:
Now, if the component is used inside a Surface form context with the form having a changeset, as here:
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
The text was updated successfully, but these errors were encountered: