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
Browsers you attempted to reproduce this bug on: Firefox 129.0b9, Chrome 127.0.6533.74
Does the problem persist after removing "assets/node_modules" and trying again? Yes
Actual behavior
Start a long-running upload.
Remount the current LiveView during upload (clicking "same, but different" in my example).
This should create a new LiveView process that reuses the existing websocket connection. The new LiveView again sets up uploads.
However, on the frontend, the JavaScript happily keeps uploading and sending messages to the over the existing websocket connection, to the new LiveView process. This new LiveView process doesn't have the old upload state, thus crashes like this:
A similar thing happens when navigating to another LiveView:
Start a long-running upload.
Navigate away (clicking "another page" in my example).
In my example, the new LiveView process didn't call allow_uploads, and thus doesn't have an uploading state, raising this error when the JavaScript happily reports upload progress:
** (ArgumentError) no uploads have been allowed on LiveView named ReproductionWeb.OtherLive
(phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/upload.ex:195: Phoenix.LiveView.Upload.get_upload_by_ref!/2
(phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/upload.ex:126: Phoenix.LiveView.Upload.update_progress/4
(phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/channel.ex:176: anonymous fn/4 in Phoenix.LiveView.Channel.handle_info/2
(phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/channel.ex:1419: Phoenix.LiveView.Channel.write_socket/4
(phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/channel.ex:174: Phoenix.LiveView.Channel.handle_info/2
Update: it only happens with JS-based external uploaders. Phoenix.LiveView.UploadWriters are terminated correctly when navigating. (See RobinBoers/lv-long-running-uploads#upload-writers).
I think this issue is related to #3287. Seems like the proposed solution there (adding a cancel callback to the JS uploader), would also work in our case.
Environment
Actual behavior
This should create a new LiveView process that reuses the existing websocket connection. The new LiveView again sets up uploads.
However, on the frontend, the JavaScript happily keeps uploading and sending messages to the over the existing websocket connection, to the new LiveView process. This new LiveView process doesn't have the old upload state, thus crashes like this:
A similar thing happens when navigating to another LiveView:
In my example, the new LiveView process didn't call
allow_uploads
, and thus doesn't have an uploading state, raising this error when the JavaScript happily reports upload progress:Expected behavior
I would expect running uploads to either:
The text was updated successfully, but these errors were encountered: