From 159f45ccb30402ef08705a05c8b6f8a3c77931c6 Mon Sep 17 00:00:00 2001 From: divyakarippath Date: Fri, 14 Aug 2020 13:13:54 -0700 Subject: [PATCH] fix: subapp ssr initial load (#1719) --- packages/subapp-web/lib/load.js | 4 ++-- packages/xarc-app-dev/src/lib/app-dev-middleware.ts | 2 +- packages/xarc-app-dev/src/lib/dev-admin/admin-server.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/subapp-web/lib/load.js b/packages/subapp-web/lib/load.js index 2c553e0975..45bb9083ad 100644 --- a/packages/subapp-web/lib/load.js +++ b/packages/subapp-web/lib/load.js @@ -220,7 +220,6 @@ Response: ${err || body}` context.user.numOfSubapps = context.user.numOfSubapps || 0; - let { group = "_" } = props; group = [].concat(group); const ssrGroups = group.map(grp => @@ -352,10 +351,11 @@ ${stack}`, } if ( + subAppLoadTime === 0 || // subapp has not been loaded yet, so must load once !request.app.webpackDev || (request.app.webpackDev && subAppLoadTime < request.app.webpackDev.compileTime) ) { - subAppLoadTime = _.get(request, "app.webpackDev.compileTime", 0); + subAppLoadTime = _.get(request, "app.webpackDev.compileTime", Date.now()); loadSubApp(); } const ref = { diff --git a/packages/xarc-app-dev/src/lib/app-dev-middleware.ts b/packages/xarc-app-dev/src/lib/app-dev-middleware.ts index b3ba7d1b69..27878d50a3 100644 --- a/packages/xarc-app-dev/src/lib/app-dev-middleware.ts +++ b/packages/xarc-app-dev/src/lib/app-dev-middleware.ts @@ -12,7 +12,7 @@ class AppDevMiddleware { webpackDev: any; constructor() { - this.webpackDev = { valid: false, hasErrors: false, hasWarnings: false }; + this.webpackDev = { valid: false, hasErrors: false, hasWarnings: false, compileTime: Date.now() }; } handleWebpackReport(data) { diff --git a/packages/xarc-app-dev/src/lib/dev-admin/admin-server.ts b/packages/xarc-app-dev/src/lib/dev-admin/admin-server.ts index 18cd0eea19..c4a521fd8c 100644 --- a/packages/xarc-app-dev/src/lib/dev-admin/admin-server.ts +++ b/packages/xarc-app-dev/src/lib/dev-admin/admin-server.ts @@ -770,7 +770,7 @@ ${info.name} - assuming it started.`); info._child.on("message", messageHandler); if (info.options.noTimeoutCheck !== true) { - startTimeout = setTimeout(handleTimeout, 5000); + startTimeout = setTimeout(handleTimeout, 20000); } return defer.promise;