Weird interaction between window.prodigy.update and wavesurfer

Hi,

I've a custom recipe that let the user rename a wavesurfer region by selecting the label and then do a double-click on the region.
To do so, I remove the region and create another one with the same timestamp and fire an "region-update-end" event. Thus, the region is removed without clicking on the 'x' (delete button) so I have to update the content of the current task with window.prodigy.update().

The issue is that every time the user interacts with the regions, (e.g. if he moves one with the mouse), the old regions are put back in prodigy.content.audio_spans, I don't know how.

For example, if there is only one region and I do (we can select the region with wavesurfer.regions.list) :
myregion.remove()
And update prodigy.content with :
window.prodigy.update({audio_spans : []})
Everything is fine (nothing on screen and nothing on prodigy.content.audio_spans).
Then if the user create/move another one, the delete region is back in prodigy.content.audio_spans (with the new one) as if the update had never been done, is that normal ?

Thanks you,
Jim

Hi! Sorry for only getting to this now! I think the problem here is that the interface also keeps internal state of the currently selected regions – so this state seems to be restored here on subsequent updates. The prodigy.window.update callback was mostly designed for custom HTML UIs where you're in control of the whole update cycle.

I'll definitely put this on the list of enhancements, though, because we'd love to have all built-in interfaces rely only on the update front-end method so you can easily interact with them programmatically like this.