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

DevTools does not handle Symbol values logged to cosole.warn/console.error #21332

Closed
leidegre opened this issue Apr 22, 2021 · 2 comments · Fixed by #21368
Closed

DevTools does not handle Symbol values logged to cosole.warn/console.error #21332

leidegre opened this issue Apr 22, 2021 · 2 comments · Fixed by #21368
Assignees
Labels
Component: Developer Tools Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@leidegre
Copy link
Contributor

React version: DevTools version 4.12.2-d14b6a4bdd

Steps To Reproduce

  1. Use console.warn from within a React component where the last argument is typeof "symbol"

Link to code example: https://codesandbox.io/s/pedantic-neumann-711ph?file=/src/App.js

The bug only happens when you make a change, so if you use the code sandbox link you need, open a new window, active dev tools, open the React dev tools and then uncomment line 5: // return null only then will the error actually happen.

I've located the culprit to this line of code

const alreadyHasComponentStack =
lastArg !== null && isStringComponentStack(lastArg);

And would offer the following change

const alreadyHasComponentStack = typeof lastArg === "string" && isStringComponentStack(lastArg);

The current behavior

React DevTools is implicitly converting a Symbol to a string.

The expected behavior

React DevTools does not implicitly try to convert a Symbol to a string.

@leidegre leidegre added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Apr 22, 2021
@eps1lon
Copy link
Collaborator

eps1lon commented Apr 23, 2021

Thanks for the report.

Also reproduced with DevTools version 4.12.3-8f202a7c8d in Chrome 90

In addition to fixing the bug, it would also be nice to guard against devtools failing so that the UI is unaffected if devtools is faulty.
/cc @bvaughn

@bvaughn bvaughn changed the title Bug: DevTools does not handle Symbol values logged to cosole.warn/console.error Apr 23, 2021
@bvaughn bvaughn self-assigned this Apr 27, 2021
@leidegre
Copy link
Contributor Author

@bvaughn Your the best, thanks for a quick turn around!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Developer Tools Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants