Skip to content
New issue

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

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

Already on GitHub? # to your account

Improve regex for getting labels on Node.js #1973

Merged
merged 2 commits into from
Aug 18, 2020

Conversation

santialbo
Copy link
Contributor

What:
I'm trying to fix some rehydration missmatch warnings using Chakra-UI (chakra-ui/chakra-ui#1446 , subsequent comments are discussing some other issue).
I found that the root of the issue was that on the node side the stack trace looked like this:

Error
    at jsx (...../node_modules/@emotion/core/dist/core.cjs.dev.js:246:17)
    at jsx (...../node_modules/@chakra-ui/system/dist/cjs/jsx.js:57:20)
    at Object.Collapse [as render] (...../node_modules/@chakra-ui/collapse/dist/cjs/collapse.js:119:26)
    ...

and the regex for getting the label was missing the name.

I'm not sure why the stack trace looks like this on the server side but this case can be easily handled by tweaking the regex a bit. Please let me know if I'm missing something or if it's there a workaround to this.

Why:

How:

Checklist:

  • Documentation
  • Tests
  • Code complete
  • Changeset

@changeset-bot
Copy link

changeset-bot bot commented Aug 14, 2020

🦋 Changeset is good to go

Latest commit: 8c4ffb7

We got this.

This PR includes changesets to release 1 package
Name Type
@emotion/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Andarist
Copy link
Member

Thanks for the report and the fix. I've looked into the repro in the linked issue and my guess is that webpack-processed bundles result in a slightly different stack traces than when the code gets executed "as is". The stack trace produced in node (the one that has failed to match against our RegExp) is more "correct" - I was able to get the same one in Chrome when I have executed code in the console. My first intuition was that this is caused by enabled source maps but I couldn't make it to produce "correct" stack traces even after disabling source maps.

Anyhow - there is no point in investigating this further. Going to merge your fix soon.

@Andarist Andarist merged commit 2cf3b16 into emotion-js:master Aug 18, 2020
@github-actions github-actions bot mentioned this pull request Aug 18, 2020
louisgv pushed a commit to louisgv/emotion that referenced this pull request Sep 6, 2020
…rapped in `React.forwardRef` (emotion-js#1973)

* Improve regex for getting labels on Node.js

* Create six-geckos-battle.md

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants