mathuo / dockview

Zero dependency Docking Layout Manager. Supports Vanilla TypeScript, React and Vue.
https://dockview.dev
MIT License
747 stars 54 forks source link

Loading of Splitview state from json adds extra div containers that break layout #721

Open alhimik45 opened 2 months ago

alhimik45 commented 2 months ago

Describe the bug api.fromJSON loads state of Splitview, but also adds two empty split-view-container divs

To Reproduce Codesandbox with reproduction. Scroll preview up and you'll find bunch of extra empty space from that unexpected divs. Duplicating api.fromJSON call leads to increased number of empty split-view-container divs

Expected behavior Extra empty divs are not added to markup

Desktop:

alhimik45 commented 2 weeks ago

In 2.0.0 still same issue with extra divs with .dv-split-view-container class.

CSS workaround if anybody interested:

/* bug https://github.com/mathuo/dockview/issues/721 workaround */
.your-splitview-class > div.dv-split-view-container:not(:last-child) {
  display: none;
}

Could not be suitable if state restoration is done very often as divs still remain in DOM and can cause memory issues.