Skip to content

fix(core): preserve edge group size when nested dockview host is hidden#1498

Merged
mathuo merged 1 commit into
masterfrom
claude/issue-1495-c6o1ac
Jul 20, 2026
Merged

fix(core): preserve edge group size when nested dockview host is hidden#1498
mathuo merged 1 commit into
masterfrom
claude/issue-1495-c6o1ac

Conversation

@mathuo

@mathuo mathuo commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Description

Fixes #1495.

When a Dockview is nested inside another Dockview's panel using the default onlyWhenVisible renderer, 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 own ResizeObserver on the shell element. Unlike the Resizable base class — which guards against hidden/detached elements via offsetParent and isInDocument before propagating a resize — this observer had no such guard. When the onlyWhenVisible host panel is deactivated, the nested Dockview's content is removed from the DOM, so the observer fires a 0×0 resize and calls layout(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). Setting renderer: 'always' avoided the bug precisely because the content was never detached.

Fix: Mirror the existing Resizable guard in the ShellManager observer — skip resize events when the shell has no offsetParent (i.e. display: none on it or an ancestor) or is no longer in the document, so edge-group sizing is preserved while hidden.

Type of change

  • Bug fix

Affected packages

  • dockview-core

How to test

  1. Create an outer Dockview with multiple panels and nest a Dockview inside one outer panel (default onlyWhenVisible renderer).
  2. Add an Edge Group to the nested Dockview and resize it larger than its minimum size.
  3. Activate another outer panel, then reactivate the panel containing the nested Dockview.
  4. The Edge Group preserves its previous size (previously it reset to the minimum).

Automated coverage: dockviewShell.spec.ts gains a resize 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 test passes (dockview-core: 1081 tests green)
  • I have added or updated tests where applicable

🤖 Generated with Claude Code


Generated by Claude Code

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
@sonarqubecloud

Copy link
Copy Markdown

@mathuo
mathuo merged commit 642755c into master Jul 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edge Group size resets to minimumSize when nested Dockview host panel becomes hidden

1 participant