Skip to content

Commit

Permalink
Don't create new uploaders for inputs with no new entries (#3053)
Browse files Browse the repository at this point in the history
  • Loading branch information
nherzing committed Feb 19, 2024
1 parent 062a2ce commit e42133a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/js/phoenix_live_view/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1065,9 +1065,13 @@ export default class View {
if(numFileInputsInProgress === 0){ onComplete() }
});

this.uploaders[inputEl] = uploader
let entries = uploader.entries().map(entry => entry.toPreflightPayload())

if (entries.length === 0) {
numFileInputsInProgress--
return
}

let payload = {
ref: inputEl.getAttribute(PHX_UPLOAD_REF),
entries: entries,
Expand Down

0 comments on commit e42133a

Please sign in to comment.