Skip to content

fix(web): preserve full-page navigation across reloads - #1384

Merged
iruriQ merged 2 commits into
BytePioneer-AI:mainfrom
zxd-666:fix/web-page-refresh
Nov 29, 2026
Merged

iruriQ merged 2 commits into
BytePioneer-AI:mainfrom
zxd-666:fix/web-page-refresh

Conversation

@zxd-666

@zxd-666 zxd-666 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Reloading Web while viewing a full-page panel currently returns to the last conversation. Preserve the selected main panel and installed plugin page in tab-scoped sessionStorage, restoring the panel after its plugin registers while ordinary startup conversation restoration continues underneath it.

  • Explicit session deep links and notification navigation immediately reveal the conversation and clear the saved main panel before resolving the session. Loading, errors, and retry remain visible even for a slow or missing target.
  • A removed main panel falls back to the conversation; an unavailable installed plugin page falls back to the plugin center.
  • Settings and other transient dialogs remain closed after reload.
  • Document page-position restoration and explicit session navigation priority; unsaved page contents are not persisted.

Validation:

  • Built the ui-layout and ui-codexhost client bundles after building their required shared contracts; rebuilt only ui-codexhost for the review fix. Staged-file formatting hooks passed.
  • Manual Chrome verification used the local authenticated Web shell with the rebuilt client bundles substituted at the browser network boundary. Installed plugin page, plugin center, and Import Sessions stay selected after ordinary reload; returning to a conversation stays there; Settings closes on reload.
  • Reproduced the deep-link regression on the original PR head. Verified the fix with both Plugins and Import Sessions saved: a 1.5-second network delay on the target summary request leaves a visible loading notice, and a missing session produces a visible error and working Retry button.
  • Injected a service-worker notification message into the real message handler and verified it exits Plugins immediately and exposes loading/error/retry. Native OS notification clicks were not exercised.
  • The running Web/Host services were not restarted. No full server rebuild or committed automated browser tests were run.

Demo after ordinary browser reload (navigation header only; private sidebar and plugin data excluded):

Plugin page remains selected after browser reload

Missing-session deep link after leaving a saved full-page panel (synthetic session ID; error and Retry are visible):

Session deep-link error and retry remain visible

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 新功能
    • 刷新浏览器页面后,可恢复上次选中的主页面或插件页签;页面尚未加载时,会在可用后恢复。
    • 页面不可用时,主页面返回会话,插件页签返回插件中心。
    • 通过会话直链或通知打开会话时,优先显示会话界面,不恢复之前的主页面。
    • 设置等弹窗、未提交的页面编辑及临时弹窗不会在刷新后恢复。
  • 文档
    • 补充了独立版网页的页面恢复行为说明。

本次更改为主面板和插件页面增加基于 sessionStorage 的选中位置恢复,并更新独立 Web 文档,说明刷新后的恢复、回退及不恢复的状态。

Changes: 浏览器页面位置恢复

Layer / File(s) Summary
主面板选择恢复
apps/web-ui/packages/client/ui-layout/src/client/service.ts, apps/web-ui/packages/client/ui-layout/src/client/index.ts, apps/web-ui/packages/client/ui-codexhost/src/client/index.ts
LayoutController 从 sessionStorage 读取待恢复的主面板 ID。待恢复面板注册后,控制器选择该面板。选择面板时保存其 ID;选择 null 或保留面板导致选择变化时,清除已保存值。apply 通过 LayoutController 调用 retainMainPanels。face.openSession 打开会话前清除选中面板。
插件页面选择恢复
apps/web-ui/packages/client/ui-codexhost/src/client/plugins-navigation.ts, docs/product/standalone-web.md
插件导航从 sessionStorage 恢复已选页面 ID,并在页面选择或列表协调时更新该 ID。文档说明刷新后的页面恢复、回退规则,以及不恢复的状态。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to 62ab0

Reload now preserves the selected full-page panel and plugin page. Explicit session links and notification clicks clear the saved panel before the session opens, so the loading and retry states stay visible. No actionable merge-blocking risk was found. The author reports manual browser checks but no automated tests, which is normal for this change.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(web): preserve full-page navigation across reloads”与变更主题一致。变更保存主面板和已安装插件页面的 sessionStorage 状态,刷新后恢复这些页面。标题未提及 sessionStorage 细节,但准确描述了主要修改。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed PR 描述与变更集直接相关。描述说明了在标签页级 sessionStorage 中保存已选主面板和插件页面,并在插件注册后恢复面板;这与摘要中 plugins-navigation.ts、ui-layout 的 service.ts 和 index.ts、以及 ui-codexhost 的 face.openSession 变更一致。描述还包含验证步骤、已知限制(不保存未提交内容)和截图。该描述不…
Full details: Description check

Explanation

PR 描述与变更集直接相关。描述说明了在标签页级 sessionStorage 中保存已选主面板和插件页面,并在插件注册后恢复面板;这与摘要中 plugins-navigation.ts、ui-layout 的 service.ts 和 index.ts、以及 ui-codexhost 的 face.openSession 变更一致。描述还包含验证步骤、已知限制(不保存未提交内容)和截图。该描述不偏离主题,因此通过检查。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@iruriQ

iruriQ commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the clean reload persistence fix! Isolated verification passed for reload retention (import page, plugins center, plugin tab), uninstalled plugin fallback, and closing settings on reload, with one blocking deep-link regression reproduced locally:

  1. Same-tab ?session=<id> deep links are masked behind the saved full-page panel (ui-codexhost/src/client/index.ts:746-754, ui-layout/src/client/service.ts:103-112):
    When a tab was last on codexhost-plugins or codexhost-import and navigates to ./?session=<id> (e.g. from a PWA notification click or Desktop --route /?session=<id>), retainMainPanels restores the saved panel before openFromUrl() calls face.openSession(sessionId). Because openSession resolves asynchronously on a fresh load and only calls selectPanel(null) after resolution succeeds, any slow-loading or missing session leaves the user stuck on the saved plugins/import page — hiding both the loading state and the SessionOpeningNotice error/retry banner.
    Calling ctx.layout.selectPanel(null) in openFromUrl() before face.openSession(sessionId) (so explicit session navigation immediately exits the saved panel and clears pendingPanelId / sessionStorage) will resolve this cleanly.

Optional non-blocking note: if a previously saved extension main panel is uninstalled before reload, retainMainPanels falls back to the conversation view, though pendingPanelId / sessionStorage remains until the user explicitly switches panel/session.

@iruriQ iruriQ added the awaiting-author Waiting for the author to respond or update the PR. label Nov 29, 2026

zxd-666 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

@iruriQ Reproduced the blocking deep-link regression on the original PR head and fixed it in 62ab080.

I put the immediate ctx.layout.selectPanel(null) in the shared face.openSession entry, before uiWorkspace.openSession, so it covers URL deep links, service-worker notification messages, and shell notification callbacks together. It clears both pending panel restoration and the saved panel before asynchronous session resolution.

Verified using rebuilt bundles in an independent Chrome session:

  • Saved Plugins and Import Sessions + a missing session deep link: loading stays visible during a 1.5-second delay on the summary request, then the error and Retry appear. Retry returns through loading to the error again.
  • A service-worker notification message exits Plugins immediately and exposes the same loading/error/retry flow. Native OS notification clicks were not exercised.
  • Ordinary reload without explicit session navigation still restores Plugins.

The PR description now includes the updated validation and a sanitized error/retry screenshot. Normal startup selection restoration uses the preserve path; the explicit-navigation entry was the problem.

For the optional stale saved extension-panel ID, I kept the existing fallback: the conversation is displayed, and the pending ID is cleared on explicit navigation. Treating an early missing registry entry as definitive removal could break restoration for a panel that registers later. This remains a non-blocking limitation; no upstream API change is needed for the blocking fix.

@iruriQ iruriQ removed the awaiting-author Waiting for the author to respond or update the PR. label Nov 29, 2026
@iruriQ
iruriQ merged commit 7edad88 into BytePioneer-AI:main Nov 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants