mozilla / perfcompare

Improved Performance Comparison Tool
Mozilla Public License 2.0
39 stars 93 forks source link

Remove the recent revisions state from redux #642

Closed julienw closed 5 months ago

julienw commented 5 months ago

The goal for this patch is to remove the recent revisions state from redux, replacing it by a local state in SearchInputAndResults.tsx.

This also removes the hook useHandleChangeSearch and the thunk searchThunk and instead moved most of their code directly to SearchInputAndResults.

The debouncing behavior was made somewhat more generic and extracted to a separate helper file. I decided to keep this super simple like it was before, so I didn't use an external dependency and implemented it simply.

Note that some of the code in searchThunk was already implemented in logic/treeherder in a previous patch so I could reuse it directly.

This also resolves a bug with the recent revisions handling between the Compare With Base and the Compare Over Time forms:

  1. Changing the repository to mozilla-central in the CompareOverTime form
  2. Focus the "new" input in CompareWithBase (the "repository" dropdown is still try in CompareWithBase)
  3. Notice the revisions for mozilla-central are displayed.

The issue was that we were using the same state for both inputs. This is solved by this patch thanks to the separate state.

You can look at the commits separately, they should be fairly straightforward when taken one by one.

netlify[bot] commented 5 months ago

Deploy Preview for mozilla-perfcompare ready!

Name Link
Latest commit c11ce4867d15b42517b923f4972a2c5de75067ff
Latest deploy log https://app.netlify.com/sites/mozilla-perfcompare/deploys/6630f384fe56ff000803f7b3
Deploy Preview https://deploy-preview-642--mozilla-perfcompare.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 96.92308% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 97.76%. Comparing base (a8d528d) to head (c11ce48).

Files Patch % Lines
src/components/Search/SearchInputAndResults.tsx 96.22% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## beta #642 +/- ## ========================================== - Coverage 97.89% 97.76% -0.13% ========================================== Files 69 66 -3 Lines 1470 1387 -83 Branches 236 235 -1 ========================================== - Hits 1439 1356 -83 Misses 29 29 Partials 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

julienw commented 5 months ago

Thanks for the review!