From ec7db4ad02ee5fb2a57abb345a87aa1096bde2c0 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:03:39 +0200 Subject: [PATCH] Debounce onChange calls to avoid unnecessary tool rebuilding --- client/src/components/Tool/ToolForm.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/components/Tool/ToolForm.vue b/client/src/components/Tool/ToolForm.vue index 0268d65bad8e..2237c564d466 100644 --- a/client/src/components/Tool/ToolForm.vue +++ b/client/src/components/Tool/ToolForm.vue @@ -120,6 +120,7 @@ import ToolEntryPoints from "components/ToolEntryPoints/ToolEntryPoints"; import { mapActions, mapState, storeToRefs } from "pinia"; import { useHistoryItemsStore } from "stores/historyItemsStore"; import { useJobStore } from "stores/jobStore"; +import { debounce } from "underscore"; import { refreshContentsWrapper } from "utils/data"; import { canMutateHistory } from "@/api"; @@ -287,7 +288,7 @@ export default { this.onUpdate(); } }, - onUpdate() { + onUpdate: debounce(function (e) { this.disabled = true; console.debug("ToolForm - Updating input parameters.", this.formData); updateToolFormData(this.formConfig.id, this.currentVersion, this.history_id, this.formData) @@ -297,7 +298,7 @@ export default { .finally(() => { this.disabled = false; }); - }, + }, 500), onChangeVersion(newVersion) { this.requestTool(newVersion); },