-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring to improve performance #1717
Conversation
@@ -295,16 +295,16 @@ function loadSubAppServerByName(name) { | |||
); | |||
} else if (serverEntry === false) { | |||
return {}; | |||
} | |||
|
|||
// generate a server from subapp's main file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified to generate server from subapps main file only if ssr is enabled
@@ -62,8 +62,11 @@ ${inlineRuntimeJS} | |||
</script>`; | |||
|
|||
// check if any subapp has server side code with initialize method and load them | |||
const subAppServers = Object.keys(subappUtil.getAllSubAppManifest()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run this only for subapps for that specific route. In subapp-server
, we set the subapps for each route to setupContext.routeOptions.__internals
@@ -193,10 +193,9 @@ Response: ${err || body}` | |||
|
|||
const loadSubApp = () => { | |||
subApp = loadSubAppByName(name); | |||
subAppServer = loadSubAppServerByName(name); | |||
subAppServer = loadSubAppServerByName(name, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we will call loadSubapp
only if ssr is enabled. Setting second argument as true
so that loadSubAppServerByName
will generate server from subapp's main file if serverEntry
is not there.
}; | ||
|
||
loadSubApp(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need this only if ssr is enabled
@@ -221,10 +220,6 @@ Response: ${err || body}` | |||
|
|||
context.user.numOfSubapps = context.user.numOfSubapps || 0; | |||
|
|||
if (request.app.webpackDev && subAppLoadTime < request.app.webpackDev.compileTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needto call loadSubApp
only if ssr is enabled. So moved it to line 356
@@ -337,14 +332,6 @@ ${stack}`, | |||
}; | |||
|
|||
const processSubapp = async () => { | |||
const ref = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need this only for ssr flow. So moved it to line 358
…-io#1717) * Refactoring to improve performance * fixing lint error * fix ssr for prod
…-io#1717) * Refactoring to improve performance * fixing lint error * fix ssr for prod
…-io#1717) * Refactoring to improve performance * fixing lint error * fix ssr for prod
…-io#1717) * Refactoring to improve performance * fixing lint error * fix ssr for prod
…-io#1717) * Refactoring to improve performance * fixing lint error * fix ssr for prod
…-io#1717) * Refactoring to improve performance * fixing lint error * fix ssr for prod
…-io#1717) * Refactoring to improve performance * fixing lint error * fix ssr for prod
https://jira.walmart.com/browse/CEECORE-1748