From 75e0a66b1debbdc4fba021feb42d662bf6e8801b Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 5 Oct 2022 12:37:04 +0200 Subject: [PATCH] feat(nc-gui): debounce updating form view data --- packages/nc-gui/components/smartsheet/Form.vue | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue index 35c9aaaafb..9718296a14 100644 --- a/packages/nc-gui/components/smartsheet/Form.vue +++ b/packages/nc-gui/components/smartsheet/Form.vue @@ -97,13 +97,17 @@ const activeRow = ref('') const { t } = useI18n() -function updateView() { - if ((formViewData.value?.subheading?.length || 0) > 255) { - message.error(t('msg.error.formDescriptionTooLong')) - return - } - updateFormView(formViewData.value) -} +const updateView = useDebounceFn( + () => { + if ((formViewData.value?.subheading?.length || 0) > 255) { + return message.error(t('msg.error.formDescriptionTooLong')) + } + + updateFormView(formViewData.value) + }, + 500, + { maxWait: 5000 }, +) async function submitForm() { try {