Skip to content

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

Closed
@leidegre

Description

@leidegre

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions