Set style nonce in root styles

This commit is contained in:
regalijan 2023-10-19 16:50:22 -04:00
parent f97ce959df
commit 3f07ebf879
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -113,6 +113,7 @@ export async function loader({
if (context.data.current_user) data = { ...context.data.current_user }; if (context.data.current_user) data = { ...context.data.current_user };
if (context.env.DSN) data.dsn = context.env.DSN; if (context.env.DSN) data.dsn = context.env.DSN;
if (context.data.nonce) data.nonce = context.data.nonce;
if (context.data.theme) data.theme = context.data.theme; if (context.data.theme) data.theme = context.data.theme;
return data; return data;
@ -175,6 +176,7 @@ function getMarkup(
{serverStyleData?.map(({ key, ids, css }) => ( {serverStyleData?.map(({ key, ids, css }) => (
<style <style
key={key} key={key}
nonce={loaderData.nonce}
data-emotion={`${key} ${ids.join(" ")}`} data-emotion={`${key} ${ids.join(" ")}`}
dangerouslySetInnerHTML={{ __html: css }} dangerouslySetInnerHTML={{ __html: css }}
/> />