Skip to content

feat(DockView): update dockview 4.7.1#565

Merged
ArgoZhang merged 8 commits intomasterfrom
update-dockview-and-fix-compatibility
Sep 2, 2025
Merged

feat(DockView): update dockview 4.7.1#565
ArgoZhang merged 8 commits intomasterfrom
update-dockview-and-fix-compatibility

Conversation

@zhaijunlei955
Copy link
Copy Markdown
Contributor

@zhaijunlei955 zhaijunlei955 commented Sep 1, 2025

Link issues

fixes #566

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Upgrade Dockview to version 4.7.1 with compatibility and performance improvements

New Features:

  • Add Gridview.normalize method with cloneNode helper to remove redundant branch layers
  • Expose popoutRestorationPromise on DockviewComponent for awaiting delayed popout group creation
  • Introduce WillShowOverlayLocationEvent for richer overlay location event data
  • Implement PositionCache in OverlayRenderContainer to batch and cache DOM position calculations

Bug Fixes:

  • Fix config saving to accurately track active panels
  • Ensure always-render panels in floating groups properly reparent their content in the DOM

Enhancements:

  • Enhance DragHandler with a disabled flag and integrate disableDnd option in Tab and Group handlers
  • Refactor drop-target and overlay styling updates to use GPU-optimized bounds functions and change detection
  • Batch overlay position updates via requestAnimationFrame and add GPU hints (will-change, translate3d, contain) in CSS
  • Queue popout group creation with incremental delays (DESERIALIZATION_POPOUT_DELAY_MS) to avoid browser popup blocking
  • Refine group and panel move logic to respect skipSetActive flags and maintain correct active group/panel state

Build:

  • Bump dockview-core version from 4.5.0 to 4.7.1

@bb-auto
Copy link
Copy Markdown

bb-auto Bot commented Sep 1, 2025

Thanks for your PR, @zhaijunlei955. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Sep 1, 2025

Reviewer's Guide

This PR updates the dockview package to v4.7.1 by adding layout-normalization and node-cloning utilities, introducing GPU-accelerated style helpers and CSS hints, improving drag-and-drop disable handling, enhancing overlay rendering via RAF-based caching, exposing a popout restoration promise with delayed creation, refining panel-move and group-activation logic, removing duplicate event classes, and applying compatibility fixes in group, panel and config modules.

Class diagram for new and updated Dockview drag-and-drop handlers

classDiagram
    class DragHandler {
        -el
        -disabled
        +constructor(el, disabled)
        +setDisabled(disabled)
        +isCancelled(event)
        +configure()
    }
    class TabDragHandler {
        +constructor(element, accessor, group, panel, disabled)
    }
    class GroupDragHandler {
        +constructor(element, accessor, group, disabled)
    }
    DragHandler <|-- TabDragHandler
    DragHandler <|-- GroupDragHandler
    TabDragHandler o-- Tab
    GroupDragHandler o-- VoidContainer
    class Tab {
        -dragHandler: TabDragHandler
        +updateDragAndDropState()
    }
    class VoidContainer {
        -handler: GroupDragHandler
        +updateDragAndDropState()
    }
Loading

Class diagram for new PositionCache and OverlayRenderContainer changes

classDiagram
    class PositionCache {
        -cache: Map
        -currentFrameId: int
        -rafId: int
        +getPosition(element)
        +invalidate()
        +scheduleFrameUpdate()
    }
    class OverlayRenderContainer {
        -positionCache: PositionCache
        -pendingUpdates: Set
        +updateAllPositions()
        +add(panel, referenceContainer)
    }
    OverlayRenderContainer o-- PositionCache
Loading

Class diagram for DockviewComponent popout restoration and normalization

classDiagram
    class DockviewComponent {
        -_popoutRestorationPromise: Promise
        +get popoutRestorationPromise()
        +fromJSON(data)
        +orthogonalize(position, options)
    }
    class Gridview {
        +normalize()
    }
    DockviewComponent o-- Gridview
Loading

Class diagram for new GPU-optimized style helpers

classDiagram
    class GPUOptimizedHelpers {
        +setGPUOptimizedBounds(element, bounds)
        +setGPUOptimizedBoundsFromStrings(element, bounds)
        +checkBoundsChanged(element, bounds)
    }
Loading

Class diagram for moveAlwaysRenderPanel and panel changes

classDiagram
    class Panel {
        +moveAlwaysRenderPanel(panel)
    }
Loading

Class diagram for config saveParamsIsActive logic

classDiagram
    class DockviewConfig {
        +saveParamsIsActive(dockview)
    }
Loading

File-Level Changes

Change Details Files
Introduce node cloning and root normalization in Gridview
  • add cloneNode utility for recursive node duplication
  • implement Gridview.normalize to collapse single-child root levels
  • bump version from 4.5.0 to 4.7.1
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Implement GPU-optimized bounds setting and CSS hints
  • add setGPUOptimizedBounds, setGPUOptimizedBoundsFromStrings and checkBoundsChanged helpers
  • replace manual style updates with GPU-accelerated helpers in overlay and drop-target logic
  • update CSS with will-change, translate3d, backface-visibility and containment directives
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
src/components/BootstrapBlazor.DockView/wwwroot/css/dockview.css
src/components/BootstrapBlazor.DockView/wwwroot/css/dockview-bb.css
Enhance drag-and-drop disable support
  • extend DragHandler to accept a disabled flag and gate dragstart
  • propagate disableDnd option through TabDragHandler, GroupDragHandler and VoidContainer
  • toggle draggable attributes and CSS cursor based on disable state
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Improve overlay rendering with RAF and position caching
  • add PositionCache and pendingUpdates to OverlayRenderContainer
  • schedule resize via requestAnimationFrame and cache DOM positions
  • introduce updateAllPositions and invoke it after layout
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Expose popout restoration promise with delayed creation
  • declare popoutRestorationPromise on DockviewComponent
  • delay popout group creation by 100ms per popup to avoid blocker
  • store and resolve a promise array for test synchronization
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Refine panel move and group activation logic
  • tweak skipSetActive behavior for center moves and merges
  • ensure groups become active after moves or maintain active panel when skipped
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Clean up duplicate code and exports
  • remove duplicate WillShowOverlayLocationEvent class definition
  • prune unused imports and consolidate export list
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js
Streamline floating group and compatibility in group actions
  • remove outdated dropdown observer logic
  • simplify float/dock transitions and rect handling
  • invoke moveAlwaysRenderPanel when creating single-panel floating groups
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-group.js
Add moveAlwaysRenderPanel for floating panels
  • implement moveAlwaysRenderPanel in dockview-panel.js
  • apply it on panel activation and export the helper
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js
Fix active flag persistence in config saving
  • update saveParamsIsActive to fallback on group.activePanel for isActive state
src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-config.js

Possibly linked issues

  • feat(UniverSheet): bump version 10.0.9 #910: The PR updates the dockview-core dependency from 4.5.0 to 4.7.1 and includes compatibility fixes, directly addressing the issue's request to bump the DockView component version.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot requested a review from ArgoZhang September 1, 2025 09:50
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-core.esm.js:9799` </location>
<code_context>
                 this.doRemoveGroup(sourceGroup, { skipActive: true });
             }
+            // Check if destination group is empty - if so, force render the component
+            const isDestinationGroupEmpty = destinationGroup.model.size === 0;
             this.movingLock(() => {
                 var _a;
                 return destinationGroup.model.openPanel(removedPanel, {
                     index: destinationIndex,
-                    skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
+                    skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
                     skipSetGroupActive: true,
                 });
</code_context>

<issue_to_address>
skipSetActive logic may be confusing when destination group is empty.

Document or refactor the logic so that callers are aware skipSetActive will be set to false when the destination group is empty, even if they pass true.
</issue_to_address>

### Comment 2
<location> `src/components/BootstrapBlazor.DockView/wwwroot/css/dockview.css:13` </location>
<code_context>
   border-radius: 2px;
   background-color: transparent;
+  /* GPU optimizations */
+  will-change: background-color, transform;
+  transform: translate3d(0, 0, 0);
+  backface-visibility: hidden;
   transition-property: background-color;
   transition-timing-function: ease-in-out;
</code_context>

<issue_to_address>
Consider limiting will-change usage to avoid excessive GPU layers.

Limit will-change to elements where GPU acceleration provides a clear benefit to prevent unnecessary memory and performance overhead.

Suggested implementation:

```
  /* GPU optimizations */
  /* Removed will-change to avoid unnecessary GPU layers */
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;

```

```
  /* GPU optimizations */
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);

```
</issue_to_address>

### Comment 3
<location> `src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-group.js:560` </location>
<code_context>
     observeOverlayChange(overlay, floatingGroup)
     observeGroup(floatingGroup)
     createGroupActions(floatingGroup, groupType)
+    if(floatingGroup.panels.length == 1) {
+        moveAlwaysRenderPanel(floatingGroup.activePanel)
+    }
     return floatingGroup
</code_context>

<issue_to_address>
moveAlwaysRenderPanel is only called for single-panel floating groups.

This logic may not handle multi-panel floating groups correctly. Please review whether always-render panels should be moved for all group sizes.
</issue_to_address>

### Comment 4
<location> `src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js:28` </location>
<code_context>
     })
 }

+const moveAlwaysRenderPanel = panel => {
+    if (panel.group.model.location.type === 'floating' && panel.renderer == 'always') {
+        if (panel === panel.group.activePanel) {
</code_context>

<issue_to_address>
moveAlwaysRenderPanel mutates parentEle property on DOM element.

Attaching custom properties to DOM elements can cause conflicts and is not recommended. Use a WeakMap or similar structure to associate data with elements instead.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +9799 to +9804
const isDestinationGroupEmpty = destinationGroup.model.size === 0;
this.movingLock(() => {
var _a;
return destinationGroup.model.openPanel(removedPanel, {
index: destinationIndex,
skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: skipSetActive logic may be confusing when destination group is empty.

Document or refactor the logic so that callers are aware skipSetActive will be set to false when the destination group is empty, even if they pass true.

Comment on lines +13 to +15
will-change: background-color, transform;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Consider limiting will-change usage to avoid excessive GPU layers.

Limit will-change to elements where GPU acceleration provides a clear benefit to prevent unnecessary memory and performance overhead.

Suggested implementation:

  /* GPU optimizations */
  /* Removed will-change to avoid unnecessary GPU layers */
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;

  /* GPU optimizations */
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);

Comment on lines +560 to +561
if(floatingGroup.panels.length == 1) {
moveAlwaysRenderPanel(floatingGroup.activePanel)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: moveAlwaysRenderPanel is only called for single-panel floating groups.

This logic may not handle multi-panel floating groups correctly. Please review whether always-render panels should be moved for all group sizes.

})
}

const moveAlwaysRenderPanel = panel => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: moveAlwaysRenderPanel mutates parentEle property on DOM element.

Attaching custom properties to DOM elements can cause conflicts and is not recommended. Use a WeakMap or similar structure to associate data with elements instead.

// Use traditional positioning for overlay containers
const left = box.left - box2.left;
const top = box.top - box2.top;
const width = box.width;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring)

Suggested change
const width = box.width;
const {width} = box;


ExplanationObject destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.

From the Airbnb Javascript Style Guide

const left = box.left - box2.left;
const top = box.top - box2.top;
const width = box.width;
const height = box.height;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Prefer object destructuring when accessing and using properties. (use-object-destructuring)

Suggested change
const height = box.height;
const {height} = box;


ExplanationObject destructuring can often remove an unnecessary temporary reference, as well as making your code more succinct.

From the Airbnb Javascript Style Guide

@ArgoZhang ArgoZhang changed the title Update dockview and fix compatibility feat(DockView): update dockview 4.7.1 Sep 2, 2025
@ArgoZhang ArgoZhang merged commit a167235 into master Sep 2, 2025
1 check passed
@ArgoZhang ArgoZhang deleted the update-dockview-and-fix-compatibility branch September 2, 2025 01:10
@bb-auto bb-auto Bot added the enhancement New feature or request label Sep 2, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(DockView): update dockview 4.7.1

2 participants