Repository navigation
fix(workbench): 修复多项目网页加载并保留独立页面状态 - #2397
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 24, 2026 14:01
14 tasks done
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 / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
同一窗口的首个项目可以打开插件网页,使用“此窗口”打开第二个项目后,网页工具窗口一直停在“正在打开…”。原生窗口只初始化第一个工作台的 WebHost,而后续项目等待各自未绑定的宿主。Markdown 等网页预览也受相同接线影响。
改动 / Changes
WebHost和就绪状态交给窗口级windowSessions,只注册一次就绪回调;回调刷新当前项目,后来打开的项目也能立即使用窗口已就绪的宿主。pluginPages、WebView、预览与桥接状态,状态读写保留工作区作用域;切换项目不共用显示页面,关闭首个项目也不销毁窗口宿主。plugin-web-tool-windows、markdown-rendering两项功能矩阵,未完成的验证继续标记pending。不在本 PR 范围内 / Out of scope
不改具体插件的业务、账号或缓存共享策略。本次修复宿主创建网页的生命周期;Windows 原生流程和实际插件的滚动、选择保持尚未验收,具体限制见下方验证。无插件协议、Core 或 Viva 版本变化。
类型专属:fix
复现与根因
0faecba49(Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799)引入多项目工作台后,App.web/webReady仍属于项目,而原生窗口只绑定首个App的配置;后续项目收不到就绪回调。检查项
second project's page = <nil>,窗口测试报the second project tab does not use the window's initialized web host;修复后全部通过。路径:desktop/internal/workbench/{plugintools,window_sessions}_test.go。.agents/notes/implemented/bug-fix/2026-11-24-project-tabs-web-host-lifetime.md。范围检查 / Scope checks
功能矩阵 / Feature matrix
pending,未将局部通过写成整项通过。verify-platform-feature-matrix-change.sh origin/main HEAD。.artifacts/生成视图。插件归属 / Plugin ownership
UI 验证 / UI evidence
TestVisualPluginWebProjectTabs,8 张 PNG 已实际检查;提交737c62877,第二项目加载/引擎不可用两种状态,light/dark × zh-Hans/en-US,1100×720 逻辑尺寸。无头驱动没有原生网页引擎,因此截图的“无法显示此窗口”是该环境的预期结果,仅证明就绪后已尝试创建网页;它不是实际插件网页成功显示的截图。真实网页创建的通过依据是 macOS 原生探针。
统一日志系统 / Structured logging
N/A:仅调整已有窗口宿主的所有权与就绪回调接线;未新增操作终态、失败、降级、重试或错误处理路径,沿用既有页面错误记录。旧日志门禁已移除,本次不将其记为通过。
界面文案 / i18n
generate-i18n.mjs --check通过,未扩大豁免或放宽脚本。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A:未修改设置、设置页或配置读写。
插件契约 / Plugin contract
N/A:未改契约、能力版本、宿主方法/通知、SDK 或固定 Core 修订;继续使用既有
ui.getState/setState。发行包与资源 / Bundle and resources
N/A:没有新增资源路径、下载、解压、缓存或运行时写入;仍执行了发行包只读边界校验并通过。
无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh test -race ./internal/workbench ./internal/pluginservice -run '^Test(ProjectTabsShareWindowWebHost|PluginToolWindows.*|PageState.*|Markdown.*|Preview.*|StandaloneMarkdown.*|ProjectMarkdown.*|ThisWindow.*|OpeningAnOpenProject.*|ClosingAProjectTab.*|ClosingTheWindow.*|SettingsWindowSizeIsEveryProjectTabs)$' -count=1 -timeout=90sscripts/desktop/desktop-go.sh test ./internal/webpreview -count=1 -timeout=120stest-stability-macos.sh --package ./internal/workbench --suite-timeout-seconds 60 -- --filter '^Test(ProjectTabsShareWindowWebHost|PluginToolWindowsKeepWebPagesPerProjectTab)$'LITHE_VISUAL_OUTPUT_DIR=… scripts/desktop/desktop-go.sh test -tags=vivahead,lithevisual ./internal/workbench -run '^TestVisualPluginWebProjectTabs$' -count=1 -v -timeout=60s--checkscripts/desktop/verify/verify-runtime-bundle-immutability.shgofmt -l、git diff --check、宿主零插件依赖自查未能执行的检查和原因:
TestClosingTheProjectClosesAReplacedProvider约 3 秒,不能据此判断该单测失败。改动相关定向 race 测试已通过,剩余交 CI。./...、Windows 本机虚拟机验收或原生性能前后基线;不宣称这些检查通过。本 PR 保持 Draft。提交前确认 / Final checks
c3cbabeed)创建,目标为main;开发期间 main 前进 3 个提交,未把其改动混入本 PR。