Repository navigation
fix(DockView): persist active panel when renderer is always - #1284
Merged
Merged
Conversation
UniMeta.Device 的 DockView 选 Render=Always 时,激活面板 F5 后丢失。 https://e.gitee.com/shanghai-xuanyi-intelligent/issues/table?issue=IKGH29
Reviewer's GuideImplementationPersist active-panel changes and coalesce move events into a save, while deriving loaded tabs from each group’s current active panel so stale activity snapshots cannot restore or load the wrong panel.
Remove obsolete explanatory comments without changing the maximize, collapsed-save, or width-handling logic.
ConfigurationReview the DockView project-file version change alongside the persistence fix.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Thanks for your PR, @zhaijunlei955. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js" line_range="223-224" />
<code_context>
+
+ // 拖拽期 core 会抑制上一条事件,程序化移动也不经 drop 处理器;0ms 合并掉一次操作的连续 fire
+ let movePanelTimer = null
+ dockview.onDidMovePanel(() => {
+ if (movePanelTimer) return
+ movePanelTimer = setTimeout(() => {
+ movePanelTimer = null
</code_context>
<issue_to_address>
**Some group merges are not persisted**
When a caller programmatically merges a group into another group at the center with `skipSetActive: true`, the merge empties the source group before DockView emits `onDidMovePanel`, and `skipSetActive: true` suppresses the active-panel save; the layout change is therefore not saved and is lost on refresh.
Ensure center merges emit a move event after completing, or explicitly save the layout for this programmatic move path.
</issue_to_address>
### Comment 2
<location path="src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js" line_range="218" />
<code_context>
saveConfig(dockview)
})
</code_context>
<issue_to_address>
**Older panel state overwrites newer state**
When server-side configuration persistence is enabled, the consumer performs asynchronous saves, and rapid panel changes cause an older save to complete after a newer one, each `saveConfig` call fires an independent asynchronous save callback without waiting for earlier calls. If the earlier save finishes last, it overwrites the newer panel selection, so a refresh restores the wrong active panel.
Serialize saves or attach a monotonically increasing revision so older snapshots cannot overwrite newer state.
</issue_to_address>
ArgoZhang
approved these changes
Nov 10, 2026
Linked issuesChecked at commit 1cd469b #1285 fix(DockView): persist active panel when renderer is always · 1 of 1 met
|
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.
关联 Issue
close #1285
现象
Renderer="DockViewRenderMode.Always"时切换活动面板(点标签 / 切到别的分组),刷新页面后激活态回退到上一次保存的值。原因
切标签只改
group.activePanel,不改变 grid 分割结构,gridview.onDidChange不会触发。唯一的非结构变更落盘路径是dockview-panel.js的可见性回调,但它受renderer === 'onlyWhenVisible' && inited限制,Always下完全不执行。因此该模式下切换活动面板从未写过配置。拖拽移动面板同样会改变激活面板,但 core 在
_moving期间不 fireonDidActivePanelChange,所以只补切标签覆盖不到这条路径。修改
wwwroot/js/dockview-utils.jsonDidActivePanelChange,切换即saveConfig;onDidMovePanel兜住拖拽/程序化移动。移动一组多面板时该事件按面板逐个 fire,用 0ms 定时器合并为一次落盘;postLayoutInit里的_loadTabs改取group.activePanel,不再遍历params.isActive快照。wwwroot/js/dockview-panel.jssaveConfig,避免与上面的监听重复写盘;_loadTabs同步改取group.activePanel。这一步是必须的:params.isActive原本靠那行saveConfig的副作用刷新,删掉后它就变成上一轮的旧值,_loadTabs会发出过期 key,对应面板内容不加载(偶发空白)。group.activePanel是 core 维护的实时值。影响面
onlyWhenVisible与Always两种模式均回归通过;验证
Summary by Sourcery
Persist DockView active-panel state reliably across refreshes in all rendering modes.
Bug Fixes:
Enhancements: