Skip to content

Commit

Permalink
Add the style tag more
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpmccormick committed Sep 18, 2024
1 parent b4e0a2d commit 535ef18
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion common/views/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
} from '@weco/common/services/app/analytics-scripts';

type DocumentInitialPropsWithTogglesAndGa = DocumentInitialProps & {
// TODO: remove style prop when Chromium fix https://issues.chromium.org/issues/367758074
style: string;
toggles: Toggles;
gaDimensions?: GaDimensions;
consentStatus: ConsentStatusProps;
Expand All @@ -45,9 +47,10 @@ class WecoDoc extends Document<DocumentInitialPropsWithTogglesAndGa> {
const consentStatus = pageProps.serverData
? pageProps.serverData?.consentStatus
: getErrorPageConsent({ req: ctx.req, res: ctx.res });

return {
...initialProps,
// TODO: remove style prop when Chromium fix https://issues.chromium.org/issues/367758074
style: sheet.getStyleElement()[0].props.dangerouslySetInnerHTML.__html,
toggles: pageProps.serverData?.toggles,
gaDimensions: pageProps.gaDimensions,
consentStatus,
Expand Down Expand Up @@ -84,6 +87,13 @@ class WecoDoc extends Document<DocumentInitialPropsWithTogglesAndGa> {

{/* https://github.com/wellcomecollection/wellcomecollection.org/issues/9286 */}
<CoreWebVitalsScript />

{/* TODO: remove style block when Chromium fix https://issues.chromium.org/issues/367758074 */}
<style
dangerouslySetInnerHTML={{
__html: this.props.style,
}}
/>
</>
</Head>
<body>
Expand Down

0 comments on commit 535ef18

Please sign in to comment.