Skip to content

Fix component disappearing when moving from floating to new grid group#1000

Merged
mathuo merged 1 commit intomasterfrom
fix/github-issue-996-component-disappears-floating-to-grid
Aug 25, 2025
Merged

Fix component disappearing when moving from floating to new grid group#1000
mathuo merged 1 commit intomasterfrom
fix/github-issue-996-component-disappears-floating-to-grid

Conversation

@mathuo
Copy link
Owner

@mathuo mathuo commented Aug 24, 2025

Summary

Fixes GitHub issue #996 where component content disappears when moving panels from floating groups back to newly created empty groups using the addGroup() + moveTo() pattern.

Problem

When users moved panels from floating groups to new grid groups using:

const addGroup = props.params.containerApi.addGroup();
props.params.api.moveTo({ group: addGroup });

The component content would disappear, making panels appear empty. This only affected moves to newly created empty groups - moves to existing groups worked fine.

Root Cause

The issue was in the moveGroupOrPanel method. When moving panels to empty groups, skipSetActive: true prevented the component from being properly rendered in the destination group's contentContainer.

Solution

File: src/dockview/dockviewComponent.ts

Added logic to detect when the destination group is empty and force component rendering by setting skipSetActive: false:

// Check if destination group is empty - if so, force render the component
const isDestinationGroupEmpty = destinationGroup.model.size === 0;

this.movingLock(() =>
    destinationGroup.model.openPanel(removedPanel, {
        index: destinationIndex,
        skipSetActive: (options.skipSetActive ?? false) && !isDestinationGroupEmpty,
        skipSetGroupActive: true,
    })
);

Testing

Added comprehensive test in the "floating groups" section of dockviewComponent.spec.ts that:

  • Reproduces the exact user scenario (floating → new empty group)
  • Verifies component content remains visible after move
  • Tests multiple panel scenarios
  • Includes proper cleanup

Verification

  • ✅ All existing tests pass (428/428)
  • ✅ New test specifically validates the fix
  • ✅ No regressions in existing floating group functionality
  • ✅ Component lifecycle properly preserved during moves

Impact

This fix ensures that panels moved from floating groups to new grid groups maintain their component content visibility, resolving the user-reported issue where components would appear empty after the move.

Closes #996

🤖 Generated with Claude Code

…grid group

When moving panels from floating groups back to newly created empty groups using
addGroup() + moveTo(), the component content was disappearing due to improper
component lifecycle management during the move operation.

The issue occurred because when moveGroupOrPanel was called with skipSetActive=true,
the component wouldn't get properly rendered in empty destination groups.

- Fix moveGroupOrPanel to force component rendering when moving to empty groups
- Add comprehensive test in floating groups section verifying the fix works
- Ensure component lifecycle is preserved during floating->grid moves

Fixes #996

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mathuo mathuo self-assigned this Aug 24, 2025
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3ca12d0:

Sandbox Source
dockview-app Configuration
editor-gridview Configuration
externaldnd-dockview Configuration
fullwidthtab-dockview Configuration
iframe-dockview Configuration
keyboard-dockview Configuration
nativeapp-dockview Configuration
rendering-dockview Configuration

@mathuo mathuo merged commit 2414e5e into master Aug 25, 2025
4 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.

After using addFloatingGroup for a floating panel, the components in the panel disappear when restoring it.

1 participant