Skip to content

Commit 9af978a

Browse files
committed
Fix disabling button during file upload
This is to fix an issue that is causing a 500 error when submitting the Tpic form before a file upload has fully completed. The lines that were restoring the button state were outside of the promise, so they re-activated the button too early.
1 parent 356a249 commit 9af978a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/javascript/controllers/upload_controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ export default class extends Controller {
4242
this.filesContainerTarget.innerHTML += data.html;
4343
filesInput.value = "";
4444
}
45-
});
4645

47-
this.submitButtonTarget.classList.remove("disabled");
48-
this.spinnerTarget.classList.add("d-none");
46+
this.submitButtonTarget.classList.remove("disabled");
47+
this.spinnerTarget.classList.add("d-none");
48+
});
4949
}
5050

5151
removeFile(event) {

0 commit comments

Comments
 (0)