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

refactor(core): code cleanup #7084

Merged
merged 1 commit into from
Apr 1, 2022
Merged

refactor(core): code cleanup #7084

merged 1 commit into from
Apr 1, 2022

Conversation

Josh-Cena
Copy link
Collaborator

Motivation

Minor code cleanup.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Builds

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 1, 2022
@netlify
Copy link

netlify bot commented Apr 1, 2022

[V2]

Name Link
🔨 Latest commit 378e8c0
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62468a9f50979200094a913e
😎 Deploy Preview https://deploy-preview-7084--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Apr 1, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 59
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-7084--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Apr 1, 2022

Size Change: -73 B (0%)

Total Size: 803 kB

Filename Size Change
website/build/assets/js/main.********.js 610 kB -73 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 49.9 kB
website/build/assets/css/styles.********.css 105 kB
website/build/index.html 38.5 kB

compressed-size-action

@Josh-Cena Josh-Cena merged commit 898611d into main Apr 1, 2022
@Josh-Cena Josh-Cena deleted the jc/refactor branch April 1, 2022 05:41
@slorber
Copy link
Collaborator

slorber commented Apr 6, 2022

I don't understand what is going on here, but that doesn't look like minor code cleanup

Please explain what is going on, and why the registry format changed for example.

I'm not against the change, but I'd like these things to not be hidden in a "code cleanup" PR with a 2 words description. It's important over time to understand why changes like these were made, and preferably doing those in separate PRs with a good explanation.

@Josh-Cena
Copy link
Collaborator Author

The registry didn't change at all—the generated code is exactly the same. The only changed thing is that all codegen now happens within the load function instead of loadRoutes, so that I can explain it better with comments instead of having the routes.js file structure scattered everywhere. There's no behavior change, hence "code cleanup".

@Josh-Cena
Copy link
Collaborator Author

Another reason—not very major, because I'm not sure yet—is that if we are to migrate to other code-splitting library, we may need to change the registry format. Right now, the loader and modulePath come from the exact same value, so it makes sense to merge them as one variable, so that we can easily change the registry format in the future.

"loader": "() => import(/* webpackChunkName: '__comp---hello-world-jse-0-f-b6c' */ 'hello/world.js')",
"modulePath": "hello/world.js",
},
"__comp---hello-world-jse-0-f-b6c": "hello/world.js",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do these snapshots change if behavior is the same as before? 🤷‍♂️

The new snapshot format is not even looking like what I have running locally, so I don't understand what is happening here

If it's a refactor, snapshots shouldn't change? 🤷‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snapshot is a shot of the internal return of loadRoutes, not what registry.js looks like. We have another snapshot for registry.js which doesn't change at all.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see thanks 👍

@slorber slorber added the pr: maintenance This PR does not produce any behavior differences to end users when upgrading. label Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: maintenance This PR does not produce any behavior differences to end users when upgrading.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants