Skip to content

fix(dashboard): preserve data tab memory when leaving workspace - #10498

Merged
Soulter merged 1 commit into
masterfrom
codex/fix-data-tab-memory
Oct 11, 2026
Merged

Soulter merged 1 commit into
masterfrom
codex/fix-data-tab-memory

Conversation

@Soulter

@Soulter Soulter commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Leaving a non-Statistics tab overwrites data_last_tab with Stats, so the Data & Logs sidebar entry forgets the user's selection. For example, Logs → Configuration Files → Data & Logs opens Statistics instead of Logs.

The watcher introduced in #10251 observes activeTab, which falls back to statistics when the destination route has no dataTab. That watcher can run before DataPage unmounts and persist the fallback. Related user feedback: #10377.

Modifications

  • Watch route.meta.dataTab directly. The existing tab lookup skips routes outside the workspace, preserving the last valid selection.
  • Document why the display fallback must not be persisted when leaving the workspace.
  • This is not a breaking change.

No documentation or screenshot update is needed: this restores the last-used-tab behavior already documented in docs/en/use/webui.md and docs/zh/use/webui.md; navigation, labels, and layout are unchanged.

Test Results

  • pnpm build in dashboard: passed, including vue-tsc --noEmit and the production Vite build.
  • ruff format .: 516 files unchanged.
  • ruff check .: passed.
  • git diff --check: passed.
  • Compiled the real DataPage setup and MainRoutes with Vue's custom renderer, stubbing visual dependencies and unrelated pages. The original code fails with Stats !== Console after Logs → Configuration Files. The fixed code passes restoration checks for all four tabs and the legacy conversation route through Configuration Files and Welcome, plus first-visit/invalid-value defaults, query/hash preservation, and a fresh app restoring Logs.
  • Verified the running development WebUI in a browser using the actual sidebar and tab links:
PASS Logs → Configuration Files → Data & Logs restores Console
PASS Trace → Configuration Files → Data & Logs restores Trace
PASS Conversations → Configuration Files → Data & Logs restores Conversation
PASS Statistics → Configuration Files → Data & Logs restores Stats
PASS reload keeps Logs selected and data_last_tab=Console

Checklist

  • Changes have been tested and verification results are provided above.
  • Affected English and Chinese WebUI documentation was checked; no update is needed as explained above.
  • No new dependencies.
  • No new features or malicious code.

Summary by Sourcery

Preserve Data & Logs tab selection across workspace navigation by saving only valid route-backed tabs.

Bug Fixes:

  • Preserve the last selected Data & Logs tab when navigating away from the data workspace, preventing the Statistics fallback from overwriting the saved selection.

Tests:

  • Verify restoration of all supported tabs across workspace navigation, reloads, legacy routes, and invalid or first-visit states.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the route metadata is wrong or missing, the change could write an incorrect tab name to localStorage, causing the workspace to reopen on the wrong tab later. Reverting stops future incorrect writes, and the stored preference can be cleared or replaced, so the impact is bounded and repairable.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@Soulter
Soulter merged commit a06ea2e into master Oct 11, 2026
23 of 24 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.

1 participant