Skip to content

Commit

Permalink
fix: debouncing of input validation
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Jan 28, 2025
1 parent 34247a9 commit 3a01a44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/src/components/inputs/InputsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,13 @@
inputsValidation: [],
multiSelectInputs: {},
inputsValidated: new Set(),
debouncedValidation: () => {}
};
},
emits: ["update:modelValue", "confirm", "validation"],
created() {
this.inputsMetaData = JSON.parse(JSON.stringify(this.initialInputs));
this.debouncedValidation = debounce(this.validateInputs, 500)
this.validateInputs().then(() => {
this.$watch("inputsValues", {
Expand All @@ -276,7 +278,7 @@
if(JSON.stringify(val) !== JSON.stringify(this.previousInputsValues)){
// only revalidate if values are stable for more than 500ms
// to avoid too many calls to the server
debounce(this.validateInputs, 500)();
this.debouncedValidation();
this.$emit("update:modelValue", this.inputsValues);
}
this.previousInputsValues = JSON.parse(JSON.stringify(val))
Expand Down

0 comments on commit 3a01a44

Please sign in to comment.