Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(helper/css): fix nonce feature #1

Conversation

usualoma
Copy link

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code

@@ -103,7 +103,7 @@ export const createCssContext = ({ id }: { id: Readonly<string> }): DefaultConte
}

const addClassNameToContext: HtmlEscapedCallback = ({ context }) => {
if (!contextMap.get(context)) {
if (!contextMap.has(context)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch 👍

@@ -62,8 +62,9 @@ export const createCssContext = ({ id }: { id: Readonly<string> }): DefaultConte
const [cssJsxDomObject, StyleRenderToDom] = createCssJsxDomObjects({ id })

const contextMap: WeakMap<object, usedClassNameData> = new WeakMap()
const nonceMap: WeakMap<object, string | undefined> = new WeakMap()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot cleaner. I like it. Thanks for the feedback and the idea 👍

@meck93 meck93 merged commit 45ce947 into meck93:feature/add-CSP-nonce-to-CSS-related-style-and-script-tags Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants