fix nested properties watcher being triggered far too often

This commit is contained in:
Henry Jameson 2022-12-21 23:45:35 +02:00
parent 045a222183
commit 3cba358743
2 changed files with 6 additions and 9 deletions

View File

@ -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)

View File

@ -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')
}