From fb2fc686b1fade7165fa595a56f025aeebceaadc Mon Sep 17 00:00:00 2001 From: Sol Fisher Romanoff Date: Wed, 22 Jun 2022 19:42:27 +0300 Subject: [PATCH] Add debounce to API request --- src/components/user_profile/user_profile.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 3ab1adba..3390e732 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -7,6 +7,7 @@ import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx' import RichContent from 'src/components/rich_content/rich_content.jsx' import List from '../list/list.vue' import withLoadMore from '../../hocs/with_load_more/with_load_more' +import { debounce } from 'lodash' import { library } from '@fortawesome/fontawesome-svg-core' import { faCircleNotch @@ -151,9 +152,9 @@ const UserProfile = { window.open(target.href, '_blank') } }, - setNote () { + setNote: debounce(function () { this.$store.dispatch('setNote', { id: this.userId, note: this.note }) - } + }, 1500) }, watch: { '$route.params.id': function (newVal) {