fix(desktop): deduplicate blank tab creation (#3219)#3741
Merged
esengine merged 8 commits intoJun 10, 2026
Conversation
Add EnsureBlankTab with a three-stage pipeline that reuses existing blank tabs, falls back to indexed blank topics on disk, and only creates a new topic as a last resort. Also short-circuit NewSession when the current tab is already blank. - EnsureBlankTab: reuse open blank tab → reuse indexed blank topic → create new - blankTabMatchesTargetLocked: helper to identify reusable blank tabs - indexedBlankTopicIDLocked: helper to find blank topics on disk not in any tab - NewSession: skip snapshot when the tab has no real conversation content - messagesHaveConversationContent: utility to check for non-system messages - Comprehensive tests covering all three stages for global and project scopes
Closed
Contributor
Author
|
别地方的合并导致该pr冲突,先进行处理 |
…DEH/DeepSeek-Reasonix into feat/3219-duplicate-blank-tabs
Contributor
Author
|
注意到新版本 UI 会去除了顶部栏,不过侧边栏仍然存在无限创建的问题,已经对其进行调整。 |
The code is self-explanatory here; drop the section-banner and line-end restating comments to match the repo comment policy.
Contributor
Author
Thank you for creating such a wonderful project. ☃️☃️ |
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.
Summary / 摘要
在进行"新建会话"操作时,新增了检测逻辑:如果当前已经有了空白会话标签页,则直接跳转到该标签页,避免重复创建。
Adds a detection path for the "New Session" flow: when a blank tab already exists, it is reused rather than creating a duplicate. This prevents repeated "new session" clicks from piling up empty conversations.
同时,在点击顶部标签页栏的"新建会话"时,如果侧边栏已经存在未打开的空白会话,则直接打开该会话,而不是创建一个全新的话题。
Additionally, when clicking "New session" from the top tab bar, if the sidebar already contains an unopened blank topic, EnsureBlankTab opens it instead of creating a fresh one — covering both the in-memory reuse path (open blank tab) and the on-disk reuse path (indexed blank topic).
What was changed / 改动清单
reuse open blank tab → reuse indexed blank topic on disk → create new topic as last resort
Skip snapshot when the current tab has no real conversation content
bridge.ts、useController.ts、App.tsx、ProjectTree.tsx):将侧边栏"新建话题"操作接入EnsureBlankTab,使其进入去重管线Wire sidebar "new topic" action through EnsureBlankTab so it enters the dedup path
Tests / 测试
Fixes #3219