Skip to content

Commit

Permalink
Only emit the "value" when dropdown selection is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
joepavitt committed Sep 7, 2023
1 parent 0efd302 commit 30f584e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ui/src/widgets/ui-dropdown/UIDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,20 @@ export default {
onChange () {
// ensure our data binding with vuex store is updated
const msg = this.messages[this.id] || {}
msg.payload = this.value
if (this.props.multiple) {
// return an array
msg.payload = this.value.map((option) => {
return option.value
})
} else if (this.value) {
// return a single value
msg.payload = this.value.value
} else {
// return null
msg.payload = null
}
this.$store.commit('data/bind', msg)
this.$socket.emit('widget-change', this.id, this.value)
this.$socket.emit('widget-change', this.id, msg.payload)
}
}
}
Expand Down

0 comments on commit 30f584e

Please sign in to comment.