dockview icon indicating copy to clipboard operation
dockview copied to clipboard

defaultRenderer='onlyWhenVisible' does not unmount react component on non-selected tabs

Open luciodale opened this issue 6 months ago • 2 comments

Describe the bug When passing the prop defaultRenderer='onlyWhenVisible', dockview doesn't unmount the component when the related tab is in the view, but not selected. The component useEffects and console.logs are still happening, although I don't see any DOM reference of that component.

To Reproduce I used the react tabview example as a starting point: https://codesandbox.io/p/sandbox/serverless-water-z48dxp?file=%2Fsrc%2Fapp.tsx%3A39%2C49

As you can see, the intervals still run for both Default 1 and Default 2 components, no matter whether the tabs are visible or not.

Expected behavior I expect the invisible component, which gets properly removed from the DOM, to unmount, with all its life cycle methods being properly called.

luciodale avatar Jul 30 '25 12:07 luciodale

https://dockview.dev/docs/core/panels/rendering#live-example

I guess it's wanted behaviour..

luciodale avatar Jul 30 '25 13:07 luciodale

Could the full unmounting behaviour be added as another defaultRenderer value? My use case is that I have many expensive components, and I don't want to keep their life cycle methods running in the background..

luciodale avatar Jul 30 '25 13:07 luciodale