fix(core): preserve edge group size when nested dockview host is hidden#1498
Merged
Conversation
The ShellManager installs its own ResizeObserver on the shell element to drive the edge-group splitview layout. Unlike the Resizable base class, it did not guard against the element being hidden or detached from the DOM. When a nested dockview's `onlyWhenVisible` host panel is deactivated the shell element collapses to (0, 0), so the observer laid the splitview out at zero and clamped the low-priority edge groups down to their minimum size — losing the user's sizing when the panel was later reactivated. Skip resize events when the shell has no offsetParent (display: none on it or an ancestor) or is no longer in the document, mirroring the existing guard in Resizable. Fixes #1495 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018axBKCULSaEET94Tefd1Ru
|
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes #1495.
When a Dockview is nested inside another Dockview's panel using the default
onlyWhenVisiblerenderer, switching to a different outer tab and back reset the nested Edge Group's size to its minimum.Root cause:
ShellManager(which owns the edge-group splitview) installs its ownResizeObserveron the shell element. Unlike theResizablebase class — which guards against hidden/detached elements viaoffsetParentandisInDocumentbefore propagating a resize — this observer had no such guard. When theonlyWhenVisiblehost panel is deactivated, the nested Dockview's content is removed from the DOM, so the observer fires a0×0resize and callslayout(0, 0). Laying the splitview out at zero clamps the low-priority edge group down to its minimum size, and that space is not recovered when the panel reappears (the splitview returns regained space to the high-priority center). Settingrenderer: 'always'avoided the bug precisely because the content was never detached.Fix: Mirror the existing
Resizableguard in theShellManagerobserver — skip resize events when the shell has nooffsetParent(i.e.display: noneon it or an ancestor) or is no longer in the document, so edge-group sizing is preserved while hidden.Type of change
Affected packages
dockview-coreHow to test
onlyWhenVisiblerenderer).Automated coverage:
dockviewShell.spec.tsgains aresize observer visibility guard (#1495)block covering both the hidden (offsetParent === null) and detached-from-document cases. Both tests fail without the fix and pass with it.Checklist
yarn testpasses (dockview-core: 1081 tests green)🤖 Generated with Claude Code
Generated by Claude Code