Closed wkirschbaum closed 2 weeks ago
Its almost certainly something we do on the form/page, but currently trying to build a minimal reproducible form.
minimum code to reproduce ( it only seems to happen with all the parts included, both phx-click event and phx-change ).
<.form id="test-form" for={@upload_form} phx-change="do-something">
<div>
<%= PhoenixHTMLHelpers.Form.radio_button(
@upload_form,
:upload_file_type,
"option 1",
"phx-click": "update-upload-type"
) %>
<%= PhoenixHTMLHelpers.Form.radio_button(
@upload_form,
:upload_file_type,
"option 2",
"phx-click": "update-upload-type"
) %>
</div>
<div class="container" phx-drop-target={@uploads.file.ref}>
<!-- ... -->
<.live_file_input upload={@uploads.file} />
</div>
<.button :if={@upload_type == "option 1"}>
Submit
</.button>
</.form>
def handle_event("do-something", params, socket) do
{:noreply, socket}
end
def handle_event("update-upload-type", %{"value" => val}, socket) do
{:noreply, socket |> assign(:upload_type, val)}
end
This is from messy code, but still a regression perhaps?
We removed the customer phx-click events and it works again. Please close if those aren't mean to be used together.
Environment
After upgrading: from phoenix 1.17.12 to 1.17.14 and phoenix_live_view 0.20.14 to 1.0.0-rc.1 our file uploads stopped functioning when within a form. We are still debugging, but logging an issue so long.
Actual behavior
On initial load the file input functions normally
but when in a form it reverts to a standard input after a phx-change event fires.
Expected behavior
I would expect the input to keep the type attribute and keep functioning as a file input.