Skip to content

Commit

Permalink
fix: add missing nonce to popstate script (#4468)
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinJSilk committed Jun 12, 2023
1 parent eed8a43 commit 54b22f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/qwik-city/runtime/src/router-outlet-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
_IMMUTABLE,
_jsxBranch,
_jsxQ,
useServerData,
} from '@builder.io/qwik';

import { ContentInternalContext } from './contexts';
Expand All @@ -18,6 +19,7 @@ import popStateScript from './init-popstate.txt?raw';
export const RouterOutlet = component$(() => {
_jsxBranch();

const nonce = useServerData<string | undefined>('nonce');
const { value } = useContext(ContentInternalContext);
if (value && value.length > 0) {
const contentsLen = value.length;
Expand All @@ -30,7 +32,7 @@ export const RouterOutlet = component$(() => {
return (
<>
{cmp}
<script dangerouslySetInnerHTML={popStateScript}></script>
<script dangerouslySetInnerHTML={popStateScript} nonce={nonce}></script>
</>
);
}
Expand Down

0 comments on commit 54b22f5

Please sign in to comment.