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 styling flicker on page load #2254

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

richardolsson
Copy link
Member

Description

This PR fixes an undocumented visual issue that would sometimes manifest on initial load. The problem seems to be that the DOM is rendered before loading JS, which is where the styling is. The changes in this PR were suggested to a similar problem reported as an MUI issue.

Screenshots

This video first browses to a survey running on main, and then on this branch. Note how the page flickers with a huge icon and unstyled text in the first tab, but not in the second tab.

flicker-vs-nonflicker.mov

Changes

  • Adds a provider for the emotion cache to pages in both the app router and the pages router

Notes to reviewer

This problem manifests most clearly on the new surveys page. You should be able to see the problem on any survey page runningmain but not on this branch.

Related issues

Undocumented

Copy link
Contributor

@ziggabyte ziggabyte left a comment

Choose a reason for hiding this comment

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

Don't we all need a cache for our emotions 😎

When I test it I can clearly see the difference, no noticable flicker for me (in firefox 🦊 ) on this branch, noticable flicker on main.

@richardolsson richardolsson merged commit a5bfff4 into main Oct 14, 2024
6 checks passed
@richardolsson richardolsson deleted the undocumented/fix-styling-flicker branch October 14, 2024 03:53
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