React Search UI is remounting its children on state or prop update

We are experiencing an issue with the search UI, whenever we perform any action on search ui, it unmount and remount its children. Basically it is remounting its children again n again on any state changes.

Sample code :

 <SearchProvider config={this.config}>
          <TestComponent />

import React from "react";
export class TestComponent extends React.Component{
         return  <div>Test Component in action.</div>;

-----------output in console----------

any action on search ui component will force remounting TestComponent

@JasonStoltz could you please help us resolving the issue, we want to prevent multiple unmounting and mounting of TestComponent from the dom.

Could someone please help me?

Hey Ranjeet - sorry for the very late response on this. I've pinged @JasonStoltz for back-up, but my initial gut instinct is that we're unlikely to make a change/bugfix in the near future to this behavior, although you can certainly open an issue in the repo for it.

In the meanwhile, if it's feasible for your codebase, could I suggest moving away from React class components/componentDidMount and instead using React functional components combined with useEffect? useEffect allows you to filter reactions to changes by specific prop or variables, which might be able to help you with working around componentDidMount.

@ranjeet.tiwari Try looking at the option. This should let you specify which items from state you're using, and will ONLY re-render when those state items are updated.

As a side note, I'm still unsure why it's causing a full re-mount as it is currently. :thinking: