Repository navigation
fix(desktop): 工作面板启动器可再打开一个浏览器页签 - #2490
Merged
Merged
Conversation
Picking Browser from the work panel launcher reused the fixed plugin:pi.browser/browser tab id, so once one browser tab was open the pick only focused it and a second page could never be opened by hand. Links already open each page in its own browser tab, so the launcher was the one path still treating the browser as a singleton. When a browser tab is already open, the launcher now opens a blank browser tab with its own id. The first tab keeps the default id, and every other tool view still focuses its single open tab. fixes vastsa#2480
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only 初步审查(未运行测试、typecheck、lint 或仓库检查,无法验证运行时行为)。修改给启动器再次选择浏览器时生成独立 id 的空白浏览器页签,其他插件视图仍复用已有页签。未发现有确切新增行证据的确定缺陷;但 `sourceTabId` 替换路径与普通启动器路径的行为、并发创建多个页签时的 id 唯一性,以及旧状态迁移/序列化兼容性需在完整环境中验证。
No evidenced findings in the supplied diff.
Head: e66bb0c
Base: 48a6558
CI: success; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
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.
问题
#2480:在工作面板里通过“+”打开内置浏览器后,再次点“+”选“浏览器”,开不出第二个浏览器页签。
原因
工作面板的启动器选“浏览器”时,页签 id 固定为
plugin:pi.browser/browser(pluginWorkPanelTab)。已经开着一个浏览器页签时,selectTool/replaceWorkPanelTabState发现这个 id 已存在,就只切回原来的页签,并关掉刚新建的空白页签。而对话里点链接走的是
browserPluginTab(url),每次都会生成新 id,所以点链接能开出多个浏览器页签(#1086 / e8684dd 已支持)。也就是说,只有从启动器手动打开这条路还把浏览器当成只能开一个。修复
apps/desktop/src/lib/work-panel-tabs.ts新增launcherWorkPanelTab(tabs, tab):如果选的是浏览器,并且已经开着默认浏览器页签,就返回一个有独立 id 的空白浏览器页签;其他情况原样返回。apps/desktop/src/components/workpanel/WorkPanel.tsx的selectTool改用它。docs/spec/04-ux/09-interaction-patterns.md:插件视图只能开一个,浏览器例外,每个页面一个页签。测试
work-panel-tabs.test.mjs新增用户路径测试:连续两次在启动器里选“浏览器”,应该有两个浏览器页签,并且切到新开的那个,不留下空白启动页签;“审查”重复打开仍然只有一个页签。不带修复时失败,带修复后通过。work-panel.test.mjs里检查代码写法的断言改成新的写法。pnpm check:pr-base。fixes #2480