Skip to content

Conversation

@julienw
Copy link
Contributor

@julienw julienw commented Jan 6, 2025

This fixes 2 warnings:

  1. When running ProfileName.test. Here the problem was that we were calling button.click instead of fireEvent.click. The former isn't wrapped by act while the latter is.
  2. When running MenuButtons.test. Here the problem was the change in the order of the state changes apply (redux vs react components); see the comment in the component for more information.

@julienw julienw requested a review from canova January 6, 2025 18:58
@codecov
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.61%. Comparing base (64e89aa) to head (61f1010).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/components/app/MenuButtons/index.js 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5294      +/-   ##
==========================================
- Coverage   88.61%   88.61%   -0.01%     
==========================================
  Files         308      308              
  Lines       28125    28122       -3     
  Branches     7621     7620       -1     
==========================================
- Hits        24923    24920       -3     
  Misses       2987     2987              
  Partials      215      215              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@canova canova left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the warnings! Looks good to me, but let me know what you think about the comment below. It's fine by me if you choose to go with the current approach too.

Comment on lines 134 to 146
// As of React 18, If the action dispatch isn't delayed, the component will
// get rerendered with the redux changes before the react state changes are
// applied. As a result CurrentProfileUploadedInformationLoader could reset
// the profile information faster than this metaInfoPanelState was applied,
// and we were getting an error in _renderMetaInfoButton.
// Using requestAnimationFrame ensures that this component's state
// is properly applied before changing the redux state. Note that if we were
// using a function component, we could use useLayoutEffect instead.
// Note that this might not be necessary in future versions of React or
// React-Redux, so be sure to revisit this choice in the future.
requestAnimationFrame(() => {
this.props.profileRemotelyDeleted();
});
Copy link
Member

@canova canova Jan 8, 2025

Choose a reason for hiding this comment

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

Hm this is a bit hacky, but if it works it's okay for me I guess. Do we always know for sure that requestAnimationFrame will be enough for it to update the state?

Another solution might be to have a componentDidUpdate that checks if the metaInfoPanelState state has changed, and calls profileRemotelyDeleted only if it's changed.

@julienw julienw force-pushed the fix-some-test-warnings branch from 48da62f to 61f1010 Compare January 9, 2025 14:34
@julienw julienw requested a review from canova January 9, 2025 14:38
@julienw
Copy link
Contributor Author

julienw commented Jan 9, 2025

Hey @canova , I updated the code like we discussed, this looks better to me, thanks for the feedback!

Copy link
Member

@canova canova left a comment

Choose a reason for hiding this comment

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

Looks good to me! Also tested it and it works well, thanks!

@julienw julienw merged commit 6366efb into firefox-devtools:main Jan 10, 2025
17 of 18 checks passed
@julienw julienw mentioned this pull request Jan 15, 2025
julienw added a commit that referenced this pull request Jan 15, 2025
Updates:

[Nicolas Chevobbe] Adapt Keyboard shortcut dialog in High Contrast Mode. (#5245)
[Nicolas Chevobbe] Fix sidebar-toggle in High Contrast Mode. (#5246)
[Nicolas Chevobbe] Fix timeline selection overlay time / hover line in High Contrast Mode (#5247)
[Zac Spitzer] fix broken link for processed profile format (#5267)
[Greg Tatum] Update the memory allocation docs and add DHAT docs (#5270)
[Markus Stange] Simplify some code related to thread CPU deltas (#5265)
[Greg Tatum] Update dhat convertor to work better with valgrind (#5269)
[Markus Stange] Rename UniqueStringArray to StringTable. (#5283)
[Markus Stange] Use snapshot testing in the symbolicator CLI test. (#5284)
[Markus Stange] Fix two confused upgraders which didn't expect to be run on the serialized format. (#5285)
[Nicolas Chevobbe] Fix timelineSettingsHiddenTracks in High Contrast Mode. (#5250)
[Julien Wajsberg] Fix some test and non-test warnings (#5294)
[Nisarg Jhaveri] Support importing simpleperf trace files from Android Studio (#5212)
[Sean Kim] Add HTTP response status code in the profiler network tab (#5297)
[Markus Stange] Change StringTable API a bit. (#5286)
[Markus Stange] Correctly declare imported simpleperf trace profiles to be of the current version. (#5312)
[Markus Stange] Two small changes (#5313)
[Nazım Can Altınova] Show sample tooltips on sample graph hover (#5298)

Also thanks to our localizers:

en-CA: chutten
es-CL: ravmn
es-CL: ravmn
fr: Théo Chevalier
ia: Melo46
ia: Melo46
sv-SE: Andreas Pettersson
uk: Lobodzets
zh-TW: Olvcpr423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants