fix BooleanSetting and ChoiceSetting not working properly on initial

launch as anon visitor (would show all as changed, empty selects)
This commit is contained in:
Henry Jameson 2021-05-31 14:16:37 +03:00
parent 4e96af0442
commit e95412a03c
2 changed files with 6 additions and 3 deletions

View file

@ -18,8 +18,11 @@ export default {
state () { state () {
return get(this.$parent, this.path) return get(this.$parent, this.path)
}, },
defaultState () {
return get(this.$parent, this.pathDefault)
},
isChanged () { isChanged () {
return get(this.$parent, this.path) !== get(this.$parent, this.pathDefault) return this.state !== undefined && this.state !== this.defaultState
} }
}, },
methods: { methods: {

View file

@ -17,13 +17,13 @@ export default {
return [firstSegment + 'DefaultValue', ...rest].join('.') return [firstSegment + 'DefaultValue', ...rest].join('.')
}, },
state () { state () {
return get(this.$parent, this.path) return get(this.$parent, this.path) || get(this.$parent, this.pathDefault)
}, },
defaultState () { defaultState () {
return get(this.$parent, this.pathDefault) return get(this.$parent, this.pathDefault)
}, },
isChanged () { isChanged () {
return get(this.$parent, this.path) !== get(this.$parent, this.pathDefault) return this.state !== undefined && this.state !== this.defaultState
} }
}, },
methods: { methods: {