From 6fb172bebc105b0fc85bb6888345bf5f3fc2b72f 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 33e430d1a1a8..2df3be4b43f6 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"; @@ -284,7 +285,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) @@ -294,7 +295,7 @@ export default { .finally(() => { this.disabled = false; }); - }, + }, 500), onChangeVersion(newVersion) { this.requestTool(newVersion); },