Pass nonce to children
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { CacheProvider } from "@emotion/react";
|
||||
import { ClientStyleContext } from "./context.js";
|
||||
import createEmotionCache, { defaultCache } from "./createEmotionCache.js";
|
||||
import createEmotionCache from "./createEmotionCache.js";
|
||||
import { hydrateRoot } from "react-dom/client";
|
||||
import { Integrations } from "@sentry/tracing";
|
||||
import { RemixBrowser } from "@remix-run/react";
|
||||
@ -16,10 +16,14 @@ Sentry.init({
|
||||
});
|
||||
|
||||
function ClientCacheProvider({ children }: { children: ReactNode }) {
|
||||
const [cache, setCache] = useState(defaultCache);
|
||||
const nonce =
|
||||
document
|
||||
.querySelector("meta[name='style-nonce']")
|
||||
?.getAttribute("content") || undefined;
|
||||
const [cache, setCache] = useState(createEmotionCache(nonce));
|
||||
|
||||
function reset() {
|
||||
setCache(createEmotionCache());
|
||||
setCache(createEmotionCache(nonce));
|
||||
}
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user