-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
Prevent Cloudflare Rocket Loader deferring script #156
Prevent Cloudflare Rocket Loader deferring script #156
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Not a fan of adding this universally – not everyone uses CloudFlare. But it would be better to support spreading props onto the |
Yes, you are totally right. I've added a new prop |
@andreacassani I've temporarily disabled Rocket Loader on my site because of the flash on page load. |
is there something blocking this? I believe this would be very useful. |
What is the status for this? What is blocking, are we looking for alternative solutions? |
Thank you Solved: #281 (comment) If there is no alternative, I think this PR should be merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, but I'd like @pacocoursey to sign off on it
When using Cloudflare with Rocket Loader enabled, the script injected by next-themes gets deferred causing the screen to flash.
As per Cloudflare docs, adding
data-cfasync="false"
to the<script />
tag prevents this behavior from happening, and the flash doesn't happen anymore.I don't know if this is the best solution, but since Cloudflare is quite common and Rocket Loader is enabled by default, this might be useful for people who want to keep it enabled or for those who don't actually know it will prevent next-themes from working properly.