-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Remove method name prefix from warnings and errors #28432
Conversation
I also don't think we should add |
I'm not opposed to this change, but I wanted to provide some historical context. This was a practice adopted from some early Facebook codebases when stack traces, symbolication, and production reporting were still a total mess. Providing these helped give us some semblance of diagnostic similar to the top stack frame in modern tooling.
Also not opposed, just want to make you aware of this dependent: |
708b296
to
18ff436
Compare
DevTools itself has to do the same thing but the "correct" (meaning consistent) way is this check: react/packages/react-devtools-shared/src/backend/console.js Lines 202 to 203 in 8fb0233
Maybe we can update LogBox to do the same check? |
320cc9c
to
af31c9b
Compare
"121": "performUpdateIfNecessary: Unexpected batch number (current %s, pending %s)", | ||
"122": "%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this shifts where the second argument is, I'm going to give this a new error code. Otherwise args from old links would end up showing the argument in the wrong place on the docs page.
scripts/error-codes/codes.json
Outdated
"279": "Trying to release an event instance into a pool of a different type.", | ||
"280": "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.", | ||
"281": "Finished root should have a work-in-progress. This error is likely caused by a bug in React. Please file an issue.", | ||
"282": "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.", | ||
"283": "Element type is invalid. Received a promise that resolves to: %s. Promise elements must resolve to a class or function.", | ||
"284": "Expected ref to be a function, a string, an object returned by React.createRef(), or null.", | ||
"285": "The root failed to unmount after an error. This is likely a bug in React. Please file an issue.", | ||
"286": "%s(...): the first argument must be a React class instance. Instead received: %s.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
73e340c
to
97b4970
Compare
This pattern is a petpeeve of mine. I don't consider this best practice and so most don't have these prefixes. Very inconsistent. At best this is useless and noisey that you have to parse because the information is also in the stack trace. At worse these are misleading because they'rehighlighting something internal (like validateDOMNesting) which even suggests an internal bug. Even the ones public to React aren't necessarily what you called because you might be calling a wrapper around it. That would be properly reflected in a stack trace - which can also properly ignore list so that the first stack you see is your callsite, Which might be like render() in react-testing-library rather than createRoot() for example.
97b4970
to
8515602
Compare
This pattern is a petpeeve of mine. I don't consider this best practice and so most don't have these prefixes. Very inconsistent. At best this is useless and noisey that you have to parse because the information is also in the stack trace. At worse these are misleading because they're highlighting something internal (like validateDOMNesting) which even suggests an internal bug. Even the ones public to React aren't necessarily what you called because you might be calling a wrapper around it. That would be properly reflected in a stack trace - which can also properly ignore list so that the first stack you see is your callsite, Which might be like `render()` in react-testing-library rather than `createRoot()` for example. DiffTrain build for [d579e77](d579e77)
@sebmarkbage the WarningFilter depends on that |
### React upstream changes - facebook/react#28438 - facebook/react#28436 - facebook/react#25954 - facebook/react#28434 - facebook/react#28433 - facebook/react#28432 - facebook/react#28415 - facebook/react#27903 - facebook/react#28430 - facebook/react#28424 - facebook/react#28400 - facebook/react#28422 - facebook/react#28423 - facebook/react#28412 - facebook/react#28418 - facebook/react#28421 - facebook/react#28417 - facebook/react#28399 - facebook/react#28408 - facebook/react#28350 - facebook/react#28387 - facebook/react#28403 - facebook/react#28384 - facebook/react#28409 - facebook/react#28398 - facebook/react#28405 - facebook/react#28328 - facebook/react#28402 - facebook/react#28386 - facebook/react#28388 - facebook/react#28379 - facebook/react#28383 - facebook/react#28390 - facebook/react#28389 - facebook/react#28382 - facebook/react#28348 Closes NEXT-2600
This pattern is a petpeeve of mine. I don't consider this best practice and so most don't have these prefixes. Very inconsistent. At best this is useless and noisey that you have to parse because the information is also in the stack trace. At worse these are misleading because they're highlighting something internal (like validateDOMNesting) which even suggests an internal bug. Even the ones public to React aren't necessarily what you called because you might be calling a wrapper around it. That would be properly reflected in a stack trace - which can also properly ignore list so that the first stack you see is your callsite, Which might be like `render()` in react-testing-library rather than `createRoot()` for example.
This pattern is a petpeeve of mine. I don't consider this best practice and so most don't have these prefixes. Very inconsistent. At best this is useless and noisey that you have to parse because the information is also in the stack trace. At worse these are misleading because they're highlighting something internal (like validateDOMNesting) which even suggests an internal bug. Even the ones public to React aren't necessarily what you called because you might be calling a wrapper around it. That would be properly reflected in a stack trace - which can also properly ignore list so that the first stack you see is your callsite, Which might be like `render()` in react-testing-library rather than `createRoot()` for example. DiffTrain build for commit d579e77.
This pattern is a petpeeve of mine. I don't consider this best practice and so most don't have these prefixes. Very inconsistent.
At best this is useless and noisey that you have to parse because the information is also in the stack trace.
At worse these are misleading because they're highlighting something internal (like validateDOMNesting) which even suggests an internal bug. Even the ones public to React aren't necessarily what you called because you might be calling a wrapper around it.
That would be properly reflected in a stack trace - which can also properly ignore list so that the first stack you see is your callsite,
Which might be like
render()
in react-testing-library rather thancreateRoot()
for example.