liveview-native / liveview-native-live-form

MIT License
5 stars 7 forks source link

Input Field Fails to Update from External Selection #18

Closed zzeadhani closed 2 days ago

zzeadhani commented 1 month ago

I am encountering an issue where an input field does not update its value automatically when an option is selected from a list of choices. This issue does not occur on the web interface, where the input field updates correctly.

  attr(:form, :any)

  defp goal_input(assigns) do
    ~LVN"""
      <.input field={@form[:title]} placeholder="Buy Apartment" style="font(.title); padding(EdgeInsets(top: 10, leading: 0, bottom: 10, trailing: 0)); background(Color.white); listRowInsets(EdgeInsets());"/>
      <Text ><%= @form.source["title"]%></Text>
    """
  end

Expected Behavior:

  1. When a value is typed directly into the input field, it updates as expected.
  2. When an option is chosen from a list of 3 options, the input field should automatically be filled with the selected value, reflecting the change both in the input field and the text below it.

Actual Behavior:

  1. When typing directly into the input field, the value updates correctly.
  2. When selecting an option from the list of choices, the input field does not update automatically, although the text below the input field reflects the selected value.
bcardarella commented 2 days ago

Related to #18, cloding this in favor of that.

We have confirmed this bug. It appears that when the server sends new state values for LiveForm inputs the inputs state is not being overwritten