Environment
- Elixir version (elixir -v): 1.18.2
- Phoenix version (mix deps): 1.7.21
- Phoenix LiveView version (mix deps): 1.0.11
- Operating system: MacOS 15.5
- Browsers you attempted to reproduce this bug on (the more the merrier): Chrome
- Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: N/A
Actual behavior
We have a form that accepts a file and uploads it directly from the browser to a third party. The uploader looks like so:
Uploaders.GoogleCloud = function (entries, onViewError) {
entries.forEach((entry) => {
let xhr = new XMLHttpRequest();
xhr.open("PUT", entry.meta.url, true);
xhr.setRequestHeader("Content-Type", entry.file.type);
xhr.upload.addEventListener("progress", (event) => {
if (event.lengthComputable) {
let pct = Math.round((event.loaded / event.total) * 100);
if (pct < 100) entry.progress(pct);
}
});
xhr.onerror = () => {
entry.error();
};
xhr.onload = () => {
if (xhr.status === 200 || xhr.status === 201) {
entry.progress(100);
} else {
entry.error();
}
};
onViewError(() => xhr.abort());
xhr.send(entry.file);
});
};
In my live view I have:
# In my mount
allow_upload(:insight_file,
accept: ["video/*"],
max_file_size: @max_file_size,
max_entries: 1,
auto_upload: false,
external: &presign_upload/2
)
defp presign_upload(_entry, socket) do
{:ok, %{"id" => media_id, "url" => url}} =
Mux.create_direct_upload_url([])
{:ok, %{uploader: "GoogleCloud", key: media_id, url: url}, socket}
end
When the user clicks save the file begins to upload but the inputs are not put in readonly.
If I put a Process.sleep(5_000) in my handle_event("save", _, _) then the inputs are disabled while the handle_event processes, but not during the file upload that happens first.
Expected behavior
The inputs should be readonly during the file upload.
Environment
Actual behavior
We have a form that accepts a file and uploads it directly from the browser to a third party. The uploader looks like so:
In my live view I have:
When the user clicks save the file begins to upload but the inputs are not put in readonly.
If I put a
Process.sleep(5_000)in myhandle_event("save", _, _)then the inputs are disabled while thehandle_eventprocesses, but not during the file upload that happens first.Expected behavior
The inputs should be readonly during the file upload.