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 flash of unstyled content on some sites #770

Merged
merged 3 commits into from
Feb 10, 2024

Conversation

Psychpsyo
Copy link
Contributor

Fixes #769
This delays accessing window.innerHeight as that was causing the flash of unstyled content on the website.

Before fix:
image

After fix:
image

This delays accessing window.innerHeight as that was causing a flash of unstyled content (with accompanying console warning) on a website.
@FilipePS
Copy link
Owner

This modification doubles the execution time of the translationRoutine function.

From the original code, just place this line if (piecesToTranslate.length < 1) return; of code above the other const innerHeight = window.innerHeight;, and you will have the same result without affecting performance.

Do what I said and your pull request will be accepted.

@Psychpsyo
Copy link
Contributor Author

Do what I said and your pull request will be accepted.

Done.

@FilipePS
Copy link
Owner

Thank you for your contribution.

@FilipePS FilipePS merged commit 4ad13b7 into FilipePS:master Feb 10, 2024
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.

Flash of unstyled content when loading some sites
2 participants