Skip to content

Bugfix: handle undefined <style> tag attr.name#843

Open
LucasMatuszewski wants to merge 1 commit into
vercel:mainfrom
LucasMatuszewski:bugfix/handle-undefined-style-tag-attr-name
Open

Bugfix: handle undefined <style> tag attr.name#843
LucasMatuszewski wants to merge 1 commit into
vercel:mainfrom
LucasMatuszewski:bugfix/handle-undefined-style-tag-attr-name

Conversation

@LucasMatuszewski

Copy link
Copy Markdown

I've faced an issue when attr.name was undefined.
For example when spreading an object inside the <style> tag like this:

<style {...(key && { key })} />

I got an error on the Storybook build:

Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: /home/lucas/project-name/src/utils/withStyles.tsx: Cannot read properties of undefined (reading 'name')
    at /home/lucas/project-name/storybook/node_modules/styled-jsx/dist/babel/index.js:21535:26

And in the debugger:

Exception has occurred: TypeError: Cannot read properties of undefined (reading 'name')
  at /home/lucas/DEV/project-name/storybook/node_modules/styled-jsx/dist/babel/index.js:21535:26

I have applied the same fix as the one in isGlobalEl function from JJ Kasper (January 6th, 2019 6:09 PM).

Sorry, if I should create an issue first ;)

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.

1 participant