mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-05 23:15:58 -06:00
fix: prevent theme flashing with Cloudflare Rocket Loader
Add data-cfasync attribute to next-themes script injection to disable Cloudflare Rocket Loader for the theme script, preventing FOUC (flash of unstyled content) when the page loads.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { type AppType } from "next/dist/shared/lib/utils";
|
||||
import { ThemeProvider } from "next-themes";
|
||||
import { Theme } from "@radix-ui/themes";
|
||||
import { ThemeProvider } from "next-themes";
|
||||
import { type AppType } from "next/dist/shared/lib/utils";
|
||||
|
||||
import "@fontsource-variable/inter";
|
||||
import "@fontsource/ibm-plex-mono/400.css";
|
||||
@@ -10,7 +10,12 @@ import "@/styles/globals.css";
|
||||
|
||||
const MyApp: AppType = ({ Component, pageProps }) => {
|
||||
return (
|
||||
<ThemeProvider attribute="class" defaultTheme="system">
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
// Cloudflare Rocket Loader breaks the script injection and causes theme flashing
|
||||
scriptProps={{ "data-cfasync": "false" }}
|
||||
>
|
||||
<Theme accentColor="indigo" grayColor="slate" radius="medium" scaling="100%">
|
||||
<Component {...pageProps} />
|
||||
</Theme>
|
||||
|
||||
Reference in New Issue
Block a user