From ff557baaa9033acec18ccbe46a704debc0a58c20 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 6 Aug 2024 15:22:02 -0300 Subject: [PATCH] Makes each metatada type decide if its input should debounce or not. --- .../metadata-types/numeric/TainacanNumeric.vue | 5 ++++- .../metadata-types/tainacan-form-item.vue | 15 ++++++--------- .../metadata-types/text/TainacanText.vue | 5 ++++- .../metadata-types/textarea/TainacanTextarea.vue | 5 ++++- .../components/metadata-types/url/TainacanUrl.vue | 6 +++++- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue b/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue index 2341e2041..0c5dc369e 100644 --- a/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue +++ b/src/views/admin/components/metadata-types/numeric/TainacanNumeric.vue @@ -69,8 +69,11 @@ else value = Number(value); - this.$emit('update:value', value); + this.changeValue(value); }, + changeValue: _.debounce(function(value) { + this.$emit('update:value', value); + }, 800), onBlur() { this.$emit('blur'); }, diff --git a/src/views/admin/components/metadata-types/tainacan-form-item.vue b/src/views/admin/components/metadata-types/tainacan-form-item.vue index 65f07ecc5..a46d97324 100644 --- a/src/views/admin/components/metadata-types/tainacan-form-item.vue +++ b/src/views/admin/components/metadata-types/tainacan-form-item.vue @@ -77,7 +77,7 @@ :is-mobile-screen="isMobileScreen" :is-focused="isFocused" :is-metadata-navigation="isMetadataNavigation" - @update:value="changeValue" + @update:value="performValueChange" @blur="performValueChange" @mobile-special-focus="onMobileSpecialFocus" />