fix(DockView): wrong position when switch visible#480
Merged
Conversation
Reviewer's GuideThis PR fixes panel repositioning issues when toggling visibility by propagating visibility flags through configuration, pruning empty layout nodes, and ensuring panels are consistently registered and removed according to their visibility state. Class diagram for updated DockView panel configuration and visibility handlingclassDiagram
class Panel {
+id
+title
+renderer
+tabComponent
+contentComponent
+params
}
class Config {
+panels
}
class DockView {
+_panelVisibleChanged
+removePanel(panel)
}
Config "1" -- "*" Panel : contains
DockView --> Panel : manages
Panel : +visible
Panel : +parentId
Panel : +rect
Panel : +packup
DockView : +_panelVisibleChanged.fire({title, status})
DockView : +removePanel(panel)
Flow diagram for panel visibility propagation and handlingflowchart TD
A[User toggles panel visibility] --> B[renewConfigFromOptions propagates visible flag]
B --> C[getConfigFromContent filters empty content]
C --> D[getLeafNode sets panel.visible and registers panel]
D --> E[initDockview checks panel.params.visible]
E -- visible: false --> F[DockView removes panel]
E -- visible: true --> G[DockView fires _panelVisibleChanged with status true]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @ArgoZhang - 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-utils.js:95` </location>
<code_context>
panels.forEach(panel => {
- dockview._panelVisibleChanged?.fire({ title: panel.title, status: true });
+ const visible = panel.params.visible
+ if(!visible){
+ dockview.removePanel(panel)
+ }
+ dockview._panelVisibleChanged?.fire({ title: panel.title, status: visible });
</code_context>
<issue_to_address>
Removing panels with falsy 'visible' property may not distinguish between undefined and false.
Currently, panels with 'visible' undefined are also removed. To only remove panels explicitly set to not visible, use 'visible === false' instead of a falsy check.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if(!visible){
dockview.removePanel(panel)
}
=======
if (visible === false) {
dockview.removePanel(panel)
}
>>>>>>> REPLACE
</suggested_fix>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Link issues
fixes #479
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Fix incorrect panel positioning when toggling visibility by preserving visibility state throughout configuration, tree construction, and initialization, and by filtering out empty content.
Bug Fixes:
Enhancements: