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

fix: fixed theme flash on page load #5619

Closed
wants to merge 2 commits into from

Conversation

faustinozanetto
Copy link

Description

This PR introduces a simple fix for addressing the theme flashing that is noticeable when the page loads. It uses a custom script that mimics the setCurrentTheme function in the legacyMain.js script but directly injects into the head element. This way, the page does not need to wait for the legacyMain.js script to load to apply the theme as the script is already in the html response.

Validation

To ensure this fix works you can either do a simple page refresh, or head to the Performance tab in the developer tools and perform a profiler start with page refresh and see that there is no theme flash present.

@faustinozanetto faustinozanetto requested a review from a team as a code owner August 9, 2023 15:04
@vercel
Copy link

vercel bot commented Aug 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2023 3:05pm

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

I appreciate the effort, but we're not accepting changes against the current Node.js website right now, as we're in the process of working towards a redesign.

I would also be heavily against injected scripts with dangerouslySetInnerHTML

Read more about current efforts at #5131

@faustinozanetto faustinozanetto deleted the theme-flash-fix branch August 9, 2023 15:08
@faustinozanetto
Copy link
Author

I appreciate the effort, but we're not accepting changes against the current Node.js website right now, as we're in the process of working towards a redesign.

I would also be heavily against injected scripts with dangerouslySetInnerHTML

Read more about current efforts at #5131

Regards the script injection, next themes also uses that so maybe in the upcoming rework they should replace it with something else.

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.

None yet

2 participants