fix(Search): moved calling on .close() after invoking the results to β¦
fixes #3389
Other components closes before invoking. The Search component doesn't do this.
Both handleItemClick and selectItemOnEnter invoke before closing, which can lead to issues when close() is called after the Search component has been unmounted by the parent component (Warning: Can't perform a React state update on an unmounted component).
In this issue there also an demo in codesandbox illustrating what happens.
I found it most easy to move the .close() inside handleResultSelect, since its used by both handleItemClick and selectItemOnEnter.
π Thanks for opening this pull request! π
Here is a list of things that will help get it across the finish line:
- Run
yarn lintlocally to catch formatting errors. This will fix some errors automatically, commit and push any changes. - Run
yarn testlocally to catch errors. This ensures all components still behave as they should. - Run
yarn startto run the doc site locally and try a few pages, ensuring everything is in good working order. - Include tests when adding/changing behavior.
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.
Codecov Report
Merging #4290 (d586070) into master (16943ec) will decrease coverage by
0.00%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #4290 +/- ##
==========================================
- Coverage 99.75% 99.75% -0.01%
==========================================
Files 180 180
Lines 3241 3240 -1
==========================================
- Hits 3233 3232 -1
Misses 8 8
| Impacted Files | Coverage Ξ | |
|---|---|---|
| src/modules/Search/Search.js | 99.55% <100.00%> (-0.01%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Ξ = absolute <relative> (impact),ΓΈ = not affected,? = missing dataPowered by Codecov. Last update 66591fb...d586070. Read the comment docs.