@@ -63,6 +63,12 @@ class App extends Base {
6363 * @protected
6464 */
6565 themeFilesCache = [ ]
66+ /**
67+ * Ensures we only fetch the theme-map once per worker.
68+ * @member {Boolean} themeMapFetchStarted=false
69+ * @protected
70+ */
71+ themeMapFetchStarted = false
6672 /**
6773 * @member {String} workerId='app'
6874 * @protected
@@ -607,14 +613,18 @@ class App extends Base {
607613 onLoadApplication ( data ) {
608614 let me = this ,
609615 { config} = Neo ,
610- { appPath} = config ;
616+ windowId = data . windowId ,
617+ appConfig = Neo . windowConfigs [ windowId ] || config ,
618+ appPath = appConfig . appPath ;
611619
612- if ( config . environment !== 'development' ) {
620+ if ( appConfig . environment !== 'development' ) {
613621 appPath = appPath . startsWith ( '/' ) ? appPath . substring ( 1 ) : appPath
614622 }
615623
616624 me . importApp ( appPath ) . then ( module => {
625+ Neo . bootingWindowId = windowId ;
617626 module . onStart ( ) ;
627+ delete Neo . bootingWindowId ;
618628
619629 // short delay to ensure Component Controllers are ready
620630 config . hash && me . timeout ( 5 ) . then ( ( ) => {
@@ -647,29 +657,34 @@ class App extends Base {
647657 import ( '../manager/Window.mjs' )
648658 }
649659
650- let { config} = Neo ,
660+ let me = this ,
661+ { config} = Neo ,
651662 { data} = msg ,
652663 url = 'resources/theme-map.json' ;
653664
654665 Neo . windowConfigs = Neo . windowConfigs || { } ;
655666
656667 Neo . windowConfigs [ data . windowId ] = Neo . clone ( data , true ) ;
657668
658- if ( config . environment === 'development' || config . environment === 'dist/esm' ) {
659- url = `../../${ url } `
660- }
669+ if ( ! me . themeMapFetchStarted ) {
670+ me . themeMapFetchStarted = true ;
661671
662- if ( config . workerBasePath ?. includes ( 'node_modules' ) ) {
663- url = `../../${ url } `
664- }
672+ if ( config . environment === 'development' || config . environment === 'dist/esm' ) {
673+ url = `../../${ url } `
674+ }
665675
666- if ( url [ 0 ] !== '.' ) {
667- url = `./${ url } `
668- }
676+ if ( config . workerBasePath ?. includes ( 'node_modules' ) ) {
677+ url = `../. ./${ url } `
678+ }
669679
670- fetch ( url )
671- . then ( response => response . json ( ) )
672- . then ( data => { this . createThemeMap ( data ) } ) ;
680+ if ( url [ 0 ] !== '.' ) {
681+ url = `./${ url } `
682+ }
683+
684+ fetch ( url )
685+ . then ( response => response . json ( ) )
686+ . then ( data => { me . createThemeMap ( data ) } ) ;
687+ }
673688
674689 config . remotesApiUrl && import ( '../remotes/Api.mjs' ) . then ( module => module . default . load ( ) ) ;
675690
0 commit comments