Skip to content

Commit 9100a29

Browse files
Plotly: tweak message loading. loadedMessages was not being resposive to changes in state
1 parent f4ffcac commit 9100a29

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/components/Plotly.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ export default {
326326
return new Promise((resolve, reject) => {
327327
interval = setInterval(function () {
328328
for (const message of messages) {
329-
if (!_this.loadedMessages.includes(message.split('[')[0])) {
329+
if (!_this.loadedMessages().includes(message.split('[')[0])) {
330330
counter += 1
331331
if (counter > 30) { // 30 * 300ms = 9 s timeout
332332
console.log('not resolving')
@@ -736,6 +736,10 @@ export default {
736736
},
737737
plot () {
738738
console.log('plot()')
739+
if (this.state.expressions.length === 0) {
740+
console.log('no expressions to plot')
741+
return
742+
}
739743
plotOptions.title = this.state.file
740744
const _this = this
741745
const datasets = []
@@ -1058,6 +1062,11 @@ export default {
10581062
...annotationsParams
10591063
]
10601064
]
1065+
},
1066+
loadedMessages () {
1067+
return Object.keys(this.state.messages).map(key => {
1068+
return key.split('[')[0]
1069+
})
10611070
}
10621071
},
10631072
computed: {
@@ -1079,11 +1088,6 @@ export default {
10791088
expressions () {
10801089
return this.state.expressions
10811090
},
1082-
loadedMessages () {
1083-
return Object.keys(this.state.messages).map(key => {
1084-
return key.split('[')[0]
1085-
})
1086-
},
10871091
messagesInLog () {
10881092
return Object.keys(this.state.messageTypes).map(key => {
10891093
return key.split('[')[0]

0 commit comments

Comments
 (0)