Debounce mute word setting

This commit is contained in:
tusooa 2023-01-14 22:43:18 -05:00
parent b4cbbefbd2
commit fa3b07352b
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224

View File

@ -1,4 +1,4 @@
import { filter, trim } from 'lodash' import { filter, trim, debounce } from 'lodash'
import BooleanSetting from '../helpers/boolean_setting.vue' import BooleanSetting from '../helpers/boolean_setting.vue'
import ChoiceSetting from '../helpers/choice_setting.vue' import ChoiceSetting from '../helpers/choice_setting.vue'
import IntegerSetting from '../helpers/integer_setting.vue' import IntegerSetting from '../helpers/integer_setting.vue'
@ -29,11 +29,16 @@ const FilteringTab = {
}, },
set (value) { set (value) {
this.muteWordsStringLocal = value this.muteWordsStringLocal = value
this.debouncedSetMuteWords(value)
}
},
debouncedSetMuteWords () {
return debounce((value) => {
this.$store.dispatch('setOption', { this.$store.dispatch('setOption', {
name: 'muteWords', name: 'muteWords',
value: filter(value.split('\n'), (word) => trim(word).length > 0) value: filter(value.split('\n'), (word) => trim(word).length > 0)
}) })
} }, 1000)
} }
}, },
// Updating nested properties // Updating nested properties