Skip to content

Conversation

@emily8rown
Copy link
Contributor

@emily8rown emily8rown commented Nov 17, 2025

Summary

The built-in browser profiler supports starting/stopping with Cmd+E. For Symmetry this adds the same hotkey for react devtools profiler.

How did you test this change?

yarn build:<browser name>
yarn run test:<browser name>

Screenshot 2025-11-17 at 14 30 34

firefox:
https://github.com/user-attachments/assets/6f225b90-828f-4e79-a364-59d6bc942f83

edge:
https://github.com/user-attachments/assets/5b2e9242-f0e8-481b-99a2-2dd78099f3ac

chrome:
https://github.com/user-attachments/assets/790aab02-2867-4499-aec1-e32e38c763f9

@meta-cla meta-cla bot added the CLA Signed label Nov 17, 2025
@hoxyq hoxyq requested review from hoxyq and vzaidman November 17, 2025 15:04
quediencm69-hash

This comment was marked as spam.

Comment on lines 679 to 682
} finally {
// Restore fake timers for other tests
jest.useFakeTimers();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you actually need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically no because in the setupTest file the before each sets it to use fake timers. I guess the argument would be not being dependent on if that changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

You probably don't need fake timers here, because there is no logic that is tied to timers: intervals, timeouts, etc.

So if it passes with these lines removed, just remove it. If not, lets investigate why this is required.

Copy link
Contributor Author

@emily8rown emily8rown Nov 21, 2025

Choose a reason for hiding this comment

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

before when I used fake timers I was getting a time out after 5 seconds from the recursivelyflush in utils act and actAsync but this may just be because the profiler and its contexts have a lot of timers/ are more complex?

Copy link
Contributor Author

@emily8rown emily8rown Nov 21, 2025

Choose a reason for hiding this comment

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

I've got it to now use the fake timers and have turned recursively flush off to avoid the timeout


try {
// Render the profiler - use React.act to ensure render completes
React.act(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use utils.actAsync here? This should also allow removing the Promise on line 632.


// Dispatch keyboard event to toggle profiling on
ownerWindow.dispatchEvent(keyEvent);
await waitForProfilingState(true);
Copy link
Contributor

@hoxyq hoxyq Nov 21, 2025

Choose a reason for hiding this comment

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

Does it have to be async, though? Does it fail if you check it synchronously?

If it fails, can you try emitting the event as part of act or actAsync?

utils.act(() => ownerWindow.dispatchEvent(keyEvent));

@emily8rown emily8rown merged commit fd524fe into facebook:main Nov 21, 2025
238 checks passed
github-actions bot pushed a commit that referenced this pull request Nov 21, 2025
## Summary

The built-in browser profiler supports starting/stopping with Cmd+E. For
Symmetry this adds the same hotkey for react devtools profiler.

## How did you test this change?
yarn build:\<browser name\>
yarn run test:\<browser name\>

<img width="483" height="135" alt="Screenshot 2025-11-17 at 14 30 34"
src="https://github.com/user-attachments/assets/426939aa-15da-4c21-87a4-e949e6949482"
/>

firefox:

https://github.com/user-attachments/assets/6f225b90-828f-4e79-a364-59d6bc942f83

edge:

https://github.com/user-attachments/assets/5b2e9242-f0e8-481b-99a2-2dd78099f3ac

chrome:

https://github.com/user-attachments/assets/790aab02-2867-4499-aec1-e32e38c763f9

---------

Co-authored-by: Ruslan Lesiutin <[email protected]>

DiffTrain build for [fd524fe](fd524fe)
github-actions bot pushed a commit that referenced this pull request Nov 21, 2025
## Summary

The built-in browser profiler supports starting/stopping with Cmd+E. For
Symmetry this adds the same hotkey for react devtools profiler.

## How did you test this change?
yarn build:\<browser name\>
yarn run test:\<browser name\>

<img width="483" height="135" alt="Screenshot 2025-11-17 at 14 30 34"
src="https://github.com/user-attachments/assets/426939aa-15da-4c21-87a4-e949e6949482"
/>

firefox:

https://github.com/user-attachments/assets/6f225b90-828f-4e79-a364-59d6bc942f83

edge:

https://github.com/user-attachments/assets/5b2e9242-f0e8-481b-99a2-2dd78099f3ac

chrome:

https://github.com/user-attachments/assets/790aab02-2867-4499-aec1-e32e38c763f9

---------

Co-authored-by: Ruslan Lesiutin <[email protected]>

DiffTrain build for [fd524fe](fd524fe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants