Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add nonce parameter to cache creator
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 7d8f9ac commit 969b304
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/createEmotionCache.ts
Expand Up @@ -2,11 +2,11 @@ import createCache from "@emotion/cache";

export const defaultCache = createEmotionCache();

export default function createEmotionCache() {
export default function createEmotionCache(nonce?: string) {
// 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" })
? createCache.default({ key: "cha", nonce })
: // @ts-expect-error
createCache({ key: "cha" });
createCache({ key: "cha", nonce });
}

0 comments on commit 969b304

Please sign in to comment.