Pluggable widget: multiple define error

We have created our own custom pluggable widget. It does what it is supposed to do but sometimes we get the multiple define error when navigating away from the page that contains the widget to another page. I does not happen all the time but I do have a flow in which I can reproduce this. Do I need to do something special when the user moves away from the page containing the wizard. Some sort of tear down I am missing? I do not read anything about that in the docs. See below for the error I get:
2 answers

I guess that either the widget defines something that already is used within mxui, or (the old instance of) the widget is still there while a new page is loaded. If the second scenario is the case, I guess you would need to look at widget data clearing / re-initializing.


So I figured this out in the meantime:

  1. Widgets that are loaded before my widget is loaded work perfectly.
  2. Widgets that still need to be loaded after my widget is loaded do not work at all regardless whether those or Dojo or React widgets. 


So somehow I broke widget loading for all widgets after my widget gets loaded.

Already tried to minimize dependencies but my widget does depend on That might be causing the issue, but still do not see how.