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

feat: display message if user ended up opening hook script #31000

Merged

Conversation

hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Sep 19, 2024

In #30596 we've moved console patching to the global hook. Generally speaking, the patching happens even before React is loaded on the page.

If browser DevTools were opened after when console.error or console.warn were called, the source script will be hook.js, because of the patching.
devtools-opened-after-the-message

This is because ignore listing is not applied retroactively by Chrome DevTools.
If you had it open before console calls, Hook script would be correctly filtered out from the stack:
devtools-opened-before-the-message

I had hopes that the fix for https://issues.chromium.org/issues/345248263 will also apply ignore listing retroactively, but looks like we need to open a separate feature request for the Chrome DevTools team.

With these changes, if user attempts to open hook.js script, they are going to see this message:
Screenshot 2024-09-19 at 11 30 59

Copy link

vercel bot commented Sep 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 1:47pm

@hoxyq hoxyq merged commit c21ce4a into facebook:main Sep 19, 2024
184 checks passed
@hoxyq hoxyq deleted the react-devtools/hook-source-map-to-have-a-message branch September 19, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants