Semantic-UI-React icon indicating copy to clipboard operation
Semantic-UI-React copied to clipboard

fix(Search): moved calling on .close() after invoking the results to …

Open Trinitonn opened this issue 4 years ago β€’ 2 comments

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.

Trinitonn avatar Oct 04 '21 14:10 Trinitonn

πŸ’– Thanks for opening this pull request! πŸ’–

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to 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.

welcome[bot] avatar Oct 04 '21 14:10 welcome[bot]

Codecov Report

Merging #4290 (d586070) into master (16943ec) will decrease coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@            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 data Powered by Codecov. Last update 66591fb...d586070. Read the comment docs.

codecov-commenter avatar Oct 04 '21 15:10 codecov-commenter