elastic / search-ui

Search UI. Libraries for the fast development of modern, engaging search experiences.
https://docs.elastic.co/search-ui
Apache License 2.0
1.92k stars 368 forks source link

WithSearch: unnecessary child component rerenders #1021

Closed JeroenAdam closed 8 months ago

JeroenAdam commented 8 months ago

Maybe a newbie question. Don't hesitate to close if not a bug. I have a Notes component and a Savedsearches component as children of my WithSearch component, both those children suffer from unnecessary rerenders. The issue occurs when an onClick in the Results component triggers a function to toggle/untoggle a result's detailed view. I tried eliminating all my own code and came to the conclusion it must be related to WithSearch and/or my lack of understanding React.

Component tree image

Video You'll see many click actions, look at the children components to the left and the right. unnecessary-rerenders.webm

Expected behavior No unnecessary rerenders of child components.

Backend: Elasticsearch, packages: react-search-ui, search-ui-elasticsearch-connector

JeroenAdam commented 8 months ago

Solved by replacing PrimeReact Accordion with Reactstrap Accordion.