Remove CSP
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import createCache from "@emotion/cache";
|
||||
|
||||
export default function createEmotionCache(nonce?: string) {
|
||||
export default function createEmotionCache() {
|
||||
// The browser throws when calling .default, but the server throws if we don't call .default
|
||||
// Of course!
|
||||
return typeof document === "undefined"
|
||||
? createCache.default({ key: "cha", nonce })
|
||||
? createCache.default({ key: "cha" })
|
||||
: // @ts-expect-error
|
||||
createCache({ key: "cha", nonce });
|
||||
createCache({ key: "cha" });
|
||||
}
|
||||
|
@ -16,14 +16,10 @@ Sentry.init({
|
||||
});
|
||||
|
||||
function ClientCacheProvider({ children }: { children: ReactNode }) {
|
||||
const nonce =
|
||||
document
|
||||
.querySelector("meta[name='style-nonce']")
|
||||
?.getAttribute("content") || undefined;
|
||||
const [cache, setCache] = useState(createEmotionCache(nonce));
|
||||
const [cache, setCache] = useState(createEmotionCache());
|
||||
|
||||
function reset() {
|
||||
setCache(createEmotionCache(nonce));
|
||||
setCache(createEmotionCache());
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -10,9 +10,9 @@ export default function handleRequest(
|
||||
request: Request,
|
||||
responseStatusCode: number,
|
||||
responseHeaders: Headers,
|
||||
remixContext: EntryContext & RequestContext
|
||||
remixContext: EntryContext
|
||||
) {
|
||||
const cache = createEmotionCache(remixContext.data.nonce);
|
||||
const cache = createEmotionCache();
|
||||
const { extractCriticalToChunks } = createEmotionServer(cache);
|
||||
const html = renderToString(
|
||||
<ServerStyleContext.Provider value={null}>
|
||||
|
Reference in New Issue
Block a user