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

Empty <style> tags throw errors during rendering #70

Closed
paulcuth opened this issue Jul 22, 2024 · 1 comment
Closed

Empty <style> tags throw errors during rendering #70

paulcuth opened this issue Jul 22, 2024 · 1 comment
Assignees

Comments

@paulcuth
Copy link

The error message isn't very helpful, but I believe that it shouldn't be erroring in the first place.

Simply adding :host{} fixes the issue, but the empty case should be handled.


Steps to recreate

  • Create an element with the following code:
export default function TestElement({ html }) {
  return html`<style></style>`;
}
  • Add the element to a page
  • Navigate to the page

Expected

  • Page loads normally

Actual

  • The page isn't rendered
  • The following error message is shown instead:
Oops, something went wrong
TypeError: Cannot read properties of undefined (reading 'value')
    at applyStyleTransforms (file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:376:34)
    at expandTemplate (file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:164:32)
    at file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:35:15
    at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:2:7)
    at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
    at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
    at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
    at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
    at walk (file:///Users/me/src/my-project/node_modules/@enhance/ssr/lib/walk.mjs:14:11)
    at processCustomElements (file:///Users/me/src/my-project/node_modules/@enhance/ssr/index.mjs:27:5)
@kristoferjoseph
Copy link
Contributor

Thank you for filing this issue.
Looks like there needs to be another catch added for this case.

@kristoferjoseph kristoferjoseph self-assigned this Jul 22, 2024
kristoferjoseph added a commit that referenced this issue Jul 22, 2024
Fixes #70 Updates styleTransform function to not error when style tag…
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

No branches or pull requests

2 participants