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

fix: react-scan auto on playwright #223

Closed
wants to merge 5 commits into from
Closed

fix: react-scan auto on playwright #223

wants to merge 5 commits into from

Conversation

lxsmnsyc
Copy link
Collaborator

Currently, React Scan doesn't work when there isn't a React DevTools installed (since RDT initializes the global hook React listens to before React is loaded), which also makes our CLI not work properly.

This fix ensures that the auto script is loaded first before React.

Copy link

vercel bot commented Jan 31, 2025

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

Name Status Preview Comments Updated (UTC)
react-scan ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 5:22am

Copy link

pkg-pr-new bot commented Jan 31, 2025

Open in Stackblitz

npm i https://pkg.pr.new/aidenybai/react-scan@223

commit: aa49e9f


requestAnimationFrame(() => {
document.documentElement.appendChild(currentContainer);
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the script executed by Playwright runs such that document.documentElement is null. By using RAF we defer appending the root container.

};
startReportInterval();
logIntro();
requestAnimationFrame(() => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the previous one, we want to defer this one to ensure that the documentElement exists.

@RobPruzan
Copy link
Collaborator

I'm not seeing the scans on the following:

bun run packages/scan/dist/cli.js https://tracing.cse.buffalo.edu/student/tracing/practice

image

@lxsmnsyc
Copy link
Collaborator Author

lxsmnsyc commented Feb 7, 2025

deprecated

@lxsmnsyc lxsmnsyc closed this Feb 7, 2025
@lxsmnsyc lxsmnsyc deleted the fix-playwright branch February 17, 2025 12:32
# 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