Using the JavaScript network API for a heavily customised web UI.
I think there’s a subtle timing bug, but could just be undefined behaviour. A timing issue as sometimes I see it, and sometimes not, and the folder from which I serve my content is apparently factor in reproducibility. Or I’ve made a big mistake somewhere.
Anyway, when the song is changed, it doesn’t always update C.songStates immediately. If I explicitly bind onto the song stage change event, I can pick up the new states consistently:
In Vue.component(‘status-panel’), added the following to created function:
I’d need to look into this, but I’m away for a couple more days. I’ll look into it when I get back, but the network API is inherently async - but if you’re getting a song changed event, then the state list should also be updated by this point. If not it’s probably an issue on my side.
I can’t see how the folder you’re serving content from would affect this.
I’m back from travels now and had a closer look at this.
There definitely could be timing issues here, because the song changed event only covers the basic details of the song - it’s name, program number and selected state - basically what’s shown in the set list panel.
As you’ve discovered, to get a reliable notification of the current song’s state list you should use the songStates endpoint.
Thanks @brad, no problem, and if you’ve not done so already, can I suggest you update the example JavaScript code, and maybe update the API docs, in case others come across the same thing. John