Skip to content

Commit

Permalink
Merge pull request #193 from lsagetlethias/main
Browse files Browse the repository at this point in the history
feat: forward nonce when cache provider is used
  • Loading branch information
garronej committed Sep 18, 2023
2 parents d744d59 + da6cc4e commit 12df368
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/next/appDir.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ export function NextAppDirEmotionCacheProvider(
<>
{globals.map(({ name, style }) => (
<style
nonce={options.nonce}
key={name}
data-emotion={`${cache.key}-global ${name}`}
dangerouslySetInnerHTML={{ "__html": style }}
/>
))}
{styles !== "" && (
<style
nonce={options.nonce}
data-emotion={dataEmotionAttribute}
dangerouslySetInnerHTML={{ "__html": styles }}
/>
Expand Down
1 change: 1 addition & 0 deletions src/next/pagesDir.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function createEmotionSsrAdvancedApproach(
.styles.filter(({ css }) => css !== "")
.map(style => (
<style
nonce={options.nonce}
data-emotion={`${style.key} ${style.ids.join(" ")}`}
key={style.key}
dangerouslySetInnerHTML={{ "__html": style.css }}
Expand Down
1 change: 1 addition & 0 deletions src/nextJs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function createEmotionSsrAdvancedApproach(options: CreateCacheOption) {
.styles.filter(({ css }) => css !== "")
.map(style => (
<style
nonce={options.nonce}
data-emotion={`${
style.key
} ${style.ids.join(" ")}`}
Expand Down

0 comments on commit 12df368

Please sign in to comment.