Skip to content

Commit

Permalink
fix(autosave): validate select onChangeable et on retry
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux committed Dec 17, 2024
1 parent 009e426 commit 1c6d012
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/javascript/controllers/autosave_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ export class AutosaveController extends ApplicationController {
// Wait next tick so champs having JS can interact
// with form elements before extracting form data.
setTimeout(() => {
this.enqueueAutosaveRequest();
this.enqueueAutosaveWithValidationRequest();
this.showConditionnalSpinner(target);
}, 0);
},
inputable: (target) => this.enqueueOnInput(target, true),
inputable: (target) => {
this.enqueueOnInput(target, true);
},
hidden: (target) => {
// In comboboxes we dispatch a "change" event on hidden inputs to trigger autosave.
// We want to debounce them.
Expand Down Expand Up @@ -152,7 +154,7 @@ export class AutosaveController extends ApplicationController {

private didRequestRetry() {
if (this.#needsRetry) {
this.enqueueAutosaveRequest();
this.enqueueAutosaveWithValidationRequest();
}
}

Expand Down

0 comments on commit 1c6d012

Please sign in to comment.