Skip to content
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

Merged
merged 3 commits into from
Aug 10, 2020

Conversation

divyakarippath
Copy link
Contributor

@@ -295,16 +295,16 @@ function loadSubAppServerByName(name) {
);
} else if (serverEntry === false) {
return {};
}

// generate a server from subapp's main file
Copy link
Contributor Author

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())
Copy link
Contributor Author

@divyakarippath divyakarippath Aug 7, 2020

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);
Copy link
Contributor Author

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();
Copy link
Contributor Author

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) {
Copy link
Contributor Author

@divyakarippath divyakarippath Aug 7, 2020

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 = {
Copy link
Contributor Author

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

@divyakarippath divyakarippath requested a review from jchip August 8, 2020 00:18
@jchip jchip merged commit 1b033fb into electrode-io:master Aug 10, 2020
imgbot bot pushed a commit to yishengjiang99/electrode that referenced this pull request Aug 20, 2020
…-io#1717)

* Refactoring to improve performance

* fixing lint error

* fix ssr for prod
imgbot bot pushed a commit to yishengjiang99/electrode that referenced this pull request Oct 14, 2020
…-io#1717)

* Refactoring to improve performance

* fixing lint error

* fix ssr for prod
imgbot bot pushed a commit to yishengjiang99/electrode that referenced this pull request Oct 14, 2020
…-io#1717)

* Refactoring to improve performance

* fixing lint error

* fix ssr for prod
imgbot bot pushed a commit to yishengjiang99/electrode that referenced this pull request Oct 15, 2020
…-io#1717)

* Refactoring to improve performance

* fixing lint error

* fix ssr for prod
imgbot bot pushed a commit to yishengjiang99/electrode that referenced this pull request Oct 15, 2020
…-io#1717)

* Refactoring to improve performance

* fixing lint error

* fix ssr for prod
imgbot bot pushed a commit to yishengjiang99/electrode that referenced this pull request Oct 15, 2020
…-io#1717)

* Refactoring to improve performance

* fixing lint error

* fix ssr for prod
imgbot bot pushed a commit to yishengjiang99/electrode that referenced this pull request Oct 15, 2020
…-io#1717)

* Refactoring to improve performance

* fixing lint error

* fix ssr for prod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants