Skip to content

Commit

Permalink
Merge pull request #1146 from FlowFuse/fix-undefined-load
Browse files Browse the repository at this point in the history
Fix: Ensure we check for existence of msg before using msg.payload
  • Loading branch information
joepavitt authored Jul 30, 2024
2 parents eef020d + dd2a9bd commit 19cca2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/src/widgets/ui-button-group/UIButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default {
msg
})
// make sure we've got the relevant option selected on load of the page
if (msg.payload !== undefined) {
if (msg?.payload !== undefined) {
if (Array.isArray(msg.payload) && msg.payload.length === 0) {
this.selection = null
} else {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/widgets/ui-event/UIEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
},
created () {
// can't do this in setup as we have custom onInput function
this.$dataTracker(this.id, null, this.onLoad)
this.$dataTracker(this.id)
this.page = this.pages[this.$route.meta.id]
this.pageview()
},
Expand Down
4 changes: 2 additions & 2 deletions ui/src/widgets/ui-text-input/UITextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import { mapState } from 'vuex' // eslint-disable-line import/order
export default {
name: 'DBUIText',
name: 'DBUITextInput',
inject: ['$socket', '$dataTracker'],
props: {
id: { type: String, required: true },
Expand Down Expand Up @@ -130,7 +130,7 @@ export default {
msg
})
// make sure we've got the relevant option selected on load of the page
if (msg.payload !== undefined) {
if (msg?.payload !== undefined) {
this.textValue = msg.payload
}
},
Expand Down

0 comments on commit 19cca2b

Please sign in to comment.