Merge pull request #8485 from colinux/fix-combobox-form-having-direct-upload
fix(combobox): let direct upload finish before submitting form
This commit is contained in:
commit
e6b29af2ac
1 changed files with 9 additions and 1 deletions
|
@ -15,7 +15,15 @@ export function useDeferredSubmit(input?: HTMLInputElement): {
|
|||
const interceptFormSubmit = (event: Event) => {
|
||||
event.preventDefault();
|
||||
runCallback();
|
||||
form.submit();
|
||||
|
||||
if (
|
||||
!Array.from(form.elements).some((e) =>
|
||||
e.hasAttribute('data-direct-upload-url')
|
||||
)
|
||||
) {
|
||||
form.submit();
|
||||
}
|
||||
// else: form will be submitted by diret upload once file have been uploaded
|
||||
};
|
||||
calledRef.current = false;
|
||||
form.addEventListener('submit', interceptFormSubmit);
|
||||
|
|
Loading…
Add table
Reference in a new issue