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): optimize App entrypoint, it should not re-render when navigating #10060

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Apr 19, 2024

Motivation

Minor perf refactor, because usage of useLocation is going to trigger a lot of re-renders whenever a navigation happens.

On a Mac M3 this saves at least 1ms execution time on navigation. I guess on low-end mobile devices the impact on navigation can be more significant.

Test Plan

Nop 😅

Test links

https://deploy-preview-10060--docusaurus-2.netlify.app/

@slorber slorber added the pr: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient. label Apr 19, 2024
@slorber slorber requested a review from Josh-Cena as a code owner April 19, 2024 10:39
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 19, 2024
Copy link

netlify bot commented Apr 19, 2024

[V2]

Name Link
🔨 Latest commit d154254
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/66224aff336ec40008094753
😎 Deploy Preview https://deploy-preview-10060--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 configuration.

Copy link

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 72 🟢 98 🟢 96 🟢 100 🟠 88 Report
/docs/installation 🟠 69 🟢 96 🟢 100 🟢 100 🟠 88 Report
/docs/category/getting-started 🟠 74 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog 🟠 67 🟢 100 🟢 100 🟢 90 🟠 88 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 63 🟢 96 🟢 100 🟢 100 🟠 88 Report
/blog/tags/release 🟠 71 🟢 100 🟢 100 🟠 80 🟠 88 Report
/blog/tags 🟠 77 🟢 100 🟢 100 🟢 90 🟠 88 Report

Copy link

Size Change: +40 B (0%)

Total Size: 1.59 MB

Filename Size Change
website/build/assets/js/main.********.js 810 kB +40 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/codeTranslations.json 2 B
website/.docusaurus/docusaurus.config.mjs 26.7 kB
website/.docusaurus/globalData.json 91.2 kB
website/.docusaurus/i18n.json 930 B
website/.docusaurus/registry.js 247 kB
website/.docusaurus/routes.js 156 kB
website/.docusaurus/routesChunkNames.json 109 kB
website/.docusaurus/site-metadata.json 2.17 kB
website/build/assets/css/styles.********.css 113 kB
website/build/index.html 38 kB

compressed-size-action

@slorber slorber merged commit eb07e9d into main Apr 19, 2024
2 checks passed
@slorber slorber deleted the slorber/fix-app-rerenders-too-much branch April 19, 2024 11:13
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: performance This PR does not add a new behavior, but existing behaviors will be more memory- / time-efficient.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants