Rerender widget from modal

I’ve run into a bit of a problem I can’t work out while trying to implement an “Improve this translation” modal in the discourse-translator plugin.

After I (successfully) submit the improved translation to the server, I want to update the displayed translation which requires me to rerender the widget displaying the translation, but nothing I’ve tried works.

This is where I want to trigger the widget rerendering:

https://github.com/LeoMcA/discourse-translator/blob/improve-translation/assets/javascripts/discourse/controllers/translator-improve.js.es6#L15

And this is the widget I want to rerender:

https://github.com/LeoMcA/discourse-translator/blob/improve-translation/assets/javascripts/discourse/initializers/extend-for-translate-button.js.es6#L90

I know I’m properly updating the model with the improved translation, because when I interact with the widget (which causes a rerender) the improved translation appears in the widget in place of the old one.

It’s just how do I trigger that rerender from outside of the widget? :confused:

4 Likes