fix(conversation): cycle visible sessions with ctrl+tab#1623
fix(conversation): cycle visible sessions with ctrl+tab#1623piorpua merged 4 commits intoiOfficeAI:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa35ed6c4a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| useDeepLink(); | ||
| useNotificationClick(); | ||
| const navigate = useNavigate(); | ||
| useConversationShortcuts({ navigate }); |
There was a problem hiding this comment.
Mount the shortcut hook under LayoutContext.Provider
Because useConversationShortcuts is invoked before LayoutContext.Provider is rendered, useVisibleConversationIds() always gets useLayoutContext() === null and falls back to siderCollapsed = false (src/renderer/pages/conversation/GroupedHistory/hooks/useVisibleConversationIds.ts). In the exact case this change is trying to fix—cycling while the sidebar is collapsed—workspace conversations are still treated as hidden, so Ctrl+Tab skips them or stops entirely for conversations inside collapsed workspaces.
Useful? React with 👍 / 👎.
| if (isConversationTabShortcut(event)) { | ||
| event.preventDefault(); | ||
| const currentConversationId = location.pathname.match(/^\/conversation\/([^/]+)/)?.[1] ?? null; |
There was a problem hiding this comment.
Avoid preventing Ctrl+Tab on non-conversation routes
This handler calls preventDefault() before confirming that the user is actually on /conversation/:id. Since Layout.tsx mounts the hook at the app-shell level, authenticated /guid and /settings/* pages now swallow Ctrl+Tab without navigating anywhere. That is a user-visible regression in the web/PWA build, where Ctrl+Tab is otherwise the browser's native tab-switch shortcut.
Useful? React with 👍 / 👎.
👍 Ctrl+Tab 会话切换这个功能很棒!按侧边栏可见顺序循环切换对话,体验很自然。代码结构也很清晰, 1. 建议关注 WebUI 兼容性目前快捷键在所有环境下都会生效,在 WebUI(浏览器)中会与浏览器原生快捷键冲突:
建议参考 PR #1625 中 // 只在 Electron 桌面端拦截,WebUI 中保留浏览器原生行为
if (typeof window !== 'undefined' && !window.electronAPI) return;可以加在 2.
|
fa35ed6 to
ba0b04a
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Summary
Changes
Related Issue
Closes #1142
Test Plan