appbaseio / reactivesearch

Search UI components for React and Vue
https://opensource.appbase.io/reactivesearch
Apache License 2.0
4.89k stars 466 forks source link

ReactiveComponent : the component is never removed from the store #1829

Closed bdecarne closed 2 years ago

bdecarne commented 2 years ago

Affected Projects

React

Library Version: x.y.z

3.26.1-alpha.2

Describe the bug

A rendered ReactiveComponent will never be removed from the store. In the commit https://github.com/appbaseio/reactivesearch/commit/8d01178c97b360124f300c3f73429cb66cd5b404 a new destroyOnUnmountproperty has been added to ComponentWrapper. Unfortunately, this prop is always undefined, the removeComponent action is not called on component unmount.

bietkul commented 2 years ago

@bdecarne The commit that you've shared fixes an important issue where force re-render breaks the components. I would like to understand the use case where you don't want to keep the ReactiveComponent in store. If ReactiveComponent value/query is a concern, then it can be cleared on unmount by using a wrapper component. However, you can set the destroyOnUnmount as true to ReactiveComponent.