Hey Team,
Good morning. We have an unusual issue bubbling up from our architecture. Hoping you can help.
We use micro front ends to compose our application. Each of our Bryntum products (Gantt and Kanban) are bundled in their own MFE. The MFEs are activated when the user clicks on a UX control (similar to a button). When the MFE mounts the Bryntum product instantiates and mounts a bryntum object to the global (window) scope. This is fine the FIRST time. However, when the user clicks to mount the OTHER Bryntum MFE, we see a nasty error in the console:
We believe this is because the second Bryntum MFE is attempting to mount a duplicate copy of the bryntum object into the global scope. Our work around is to do this each time that button control is invoked:
if (window['bryntum']) {
delete window['bryntum'];
}
We execute this code BEFORE the next Bryntum MFE mounts. This works, but obviously it is a hack.
Is there a way to optimize our application to use two (or more) Bryntum products at the same time? Perhaps by configuring the Bryntum apps to check for a bryntum object on the window scope BEFORE trying to mount a duplicate instance?
Thank you for the help!