commit: 3cba358743cd2c1d92b487295774231cef68978d
parent 045a222183ac47b48e14e1639e7107aa0bffb015
Author: Henry Jameson <me@hjkos.com>
Date: Wed, 21 Dec 2022 23:45:35 +0200
fix nested properties watcher being triggered far too often
Diffstat:
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/components/settings_modal/helpers/boolean_setting.js b/src/components/settings_modal/helpers/boolean_setting.js
@@ -41,7 +41,13 @@ export default {
},
methods: {
update (e) {
+ const [firstSegment, ...rest] = this.path.split('.')
set(this.$parent, this.path, e)
+ // Updating nested properties does not trigger update on its parent.
+ // probably still not as reliable, but works for depth=1 at least
+ if (rest.length > 0) {
+ set(this.$parent, firstSegment, { ...get(this.$parent, firstSegment) })
+ }
},
reset () {
set(this.$parent, this.path, this.defaultState)
diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js
@@ -38,15 +38,6 @@ const FilteringTab = {
},
// Updating nested properties
watch: {
- notificationVisibility: {
- handler (value) {
- this.$store.dispatch('setOption', {
- name: 'notificationVisibility',
- value: this.$store.getters.mergedConfig.notificationVisibility
- })
- },
- deep: true
- },
replyVisibility () {
this.$store.dispatch('queueFlushAll')
}