fix(ui): complete session rebase integration

This commit is contained in:
c_w_xiaohei
2026-08-26 02:31:19 +08:00
parent 45693e84bd
commit 1d694932aa
3 changed files with 6 additions and 8 deletions
@@ -2,6 +2,7 @@ import React from 'react';
import type { Session } from '@opencode-ai/sdk/v2'; import type { Session } from '@opencode-ai/sdk/v2';
import { useSessionUIStore } from '@/sync/session-ui-store'; import { useSessionUIStore } from '@/sync/session-ui-store';
import { usePrefetchSessionMessages } from '@/sync/use-sync'; import { usePrefetchSessionMessages } from '@/sync/use-sync';
import { useUIStore } from '@/stores/useUIStore';
import { useGitHubAuthStore } from '@/stores/useGitHubAuthStore'; import { useGitHubAuthStore } from '@/stores/useGitHubAuthStore';
import { getGitHubPrStatusKey, useGitHubPrStatusStore } from '@/stores/useGitHubPrStatusStore'; import { getGitHubPrStatusKey, useGitHubPrStatusStore } from '@/stores/useGitHubPrStatusStore';
import { useRuntimeAPIs } from '@/hooks/useRuntimeAPIs'; import { useRuntimeAPIs } from '@/hooks/useRuntimeAPIs';
@@ -93,7 +94,6 @@ type SessionProjectCollectionProps = {
alwaysShowActions: boolean; alwaysShowActions: boolean;
notifyOnSubtasks: boolean; notifyOnSubtasks: boolean;
setActiveProjectIdOnly: (id: string) => void; setActiveProjectIdOnly: (id: string) => void;
setActiveMainTab: (tab: import('@/stores/useUIStore').MainTab) => void;
setSessionSwitcherOpen: (open: boolean) => void; setSessionSwitcherOpen: (open: boolean) => void;
openNewSessionDraft: (options?: { selectedProjectId?: string | null; directoryOverride?: string | null }) => void; openNewSessionDraft: (options?: { selectedProjectId?: string | null; directoryOverride?: string | null }) => void;
openNewWorktreeDialog: () => void; openNewWorktreeDialog: () => void;
@@ -286,6 +286,7 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
hideDirectoryControls: view.hideDirectoryControls, hideDirectoryControls: view.hideDirectoryControls,
mobileVariant: view.mobileVariant, mobileVariant: view.mobileVariant,
alwaysShowActions, alwaysShowActions,
activeProjectId: view.activeProjectId,
notifyOnSubtasks, notifyOnSubtasks,
pinnedSessionIds: collection.pinnedSessionIds, pinnedSessionIds: collection.pinnedSessionIds,
sessionOrderIndex, sessionOrderIndex,
@@ -331,6 +332,7 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
toggleParent, toggleParent,
view.hideDirectoryControls, view.hideDirectoryControls,
view.hasSessionSearchQuery, view.hasSessionSearchQuery,
view.activeProjectId,
view.mobileVariant, view.mobileVariant,
view.normalizedSessionSearchQuery, view.normalizedSessionSearchQuery,
view.useGroupedSections, view.useGroupedSections,
@@ -340,7 +342,6 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
showMoreGroupSessions, showMoreGroupSessions,
resetGroupSessionLimit, resetGroupSessionLimit,
setActiveProjectIdOnly: scrollerActions.setActiveProjectIdOnly, setActiveProjectIdOnly: scrollerActions.setActiveProjectIdOnly,
setActiveMainTab: scrollerActions.setActiveMainTab,
setSessionSwitcherOpen: scrollerActions.setSessionSwitcherOpen, setSessionSwitcherOpen: scrollerActions.setSessionSwitcherOpen,
openNewSessionDraft: scrollerActions.openNewSessionDraft, openNewSessionDraft: scrollerActions.openNewSessionDraft,
onToggleCollapsedGroup: toggleGroup, onToggleCollapsedGroup: toggleGroup,
@@ -349,7 +350,6 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
showMoreGroupSessions, showMoreGroupSessions,
toggleGroup, toggleGroup,
scrollerActions.openNewSessionDraft, scrollerActions.openNewSessionDraft,
scrollerActions.setActiveMainTab,
scrollerActions.setActiveProjectIdOnly, scrollerActions.setActiveProjectIdOnly,
scrollerActions.setSessionSwitcherOpen, scrollerActions.setSessionSwitcherOpen,
]); ]);
@@ -396,7 +396,7 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
/>; />;
}, [chatGroup, groupActions, groupProps, openSidebarMenuKey]); }, [chatGroup, groupActions, groupProps, openSidebarMenuKey]);
const handleOpenNewChat = React.useCallback(() => { const handleOpenNewChat = React.useCallback(() => {
scrollerActions.setActiveMainTab('chat'); useUIStore.getState().closeMainSurfaces();
if (view.mobileVariant) scrollerActions.setSessionSwitcherOpen(false); if (view.mobileVariant) scrollerActions.setSessionSwitcherOpen(false);
scrollerActions.openNewSessionDraft({ selectedProjectId: CHAT_DRAFT_PROJECT_ID, directoryOverride: null }); scrollerActions.openNewSessionDraft({ selectedProjectId: CHAT_DRAFT_PROJECT_ID, directoryOverride: null });
}, [scrollerActions, view.mobileVariant]); }, [scrollerActions, view.mobileVariant]);
@@ -530,7 +530,6 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
group: groupActions, group: groupActions,
toggleProject, toggleProject,
setActiveProjectIdOnly: scrollerActions.setActiveProjectIdOnly, setActiveProjectIdOnly: scrollerActions.setActiveProjectIdOnly,
setActiveMainTab: scrollerActions.setActiveMainTab,
setSessionSwitcherOpen: scrollerActions.setSessionSwitcherOpen, setSessionSwitcherOpen: scrollerActions.setSessionSwitcherOpen,
openNewSessionDraft: scrollerActions.openNewSessionDraft, openNewSessionDraft: scrollerActions.openNewSessionDraft,
openNewWorktreeDialog: scrollerActions.openNewWorktreeDialog, openNewWorktreeDialog: scrollerActions.openNewWorktreeDialog,
@@ -549,7 +548,6 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
scrollerActions.openWorktreesPage, scrollerActions.openWorktreesPage,
scrollerActions.removeProject, scrollerActions.removeProject,
scrollerActions.reorderProjects, scrollerActions.reorderProjects,
scrollerActions.setActiveMainTab,
scrollerActions.setActiveProjectIdOnly, scrollerActions.setActiveProjectIdOnly,
scrollerActions.setSessionSwitcherOpen, scrollerActions.setSessionSwitcherOpen,
setGroupOrderByProject, setGroupOrderByProject,
@@ -565,7 +563,6 @@ const VisibleSessionProjects: React.FC<SessionProjectCollectionProps> = ({ topol
persistActiveSessionByProject={actions.persistActiveSessionByProject} persistActiveSessionByProject={actions.persistActiveSessionByProject}
mobileVariant={view.mobileVariant} mobileVariant={view.mobileVariant}
openNewSessionDraft={actions.openNewSessionDraft} openNewSessionDraft={actions.openNewSessionDraft}
setActiveMainTab={actions.setActiveMainTab}
setSessionSwitcherOpen={actions.setSessionSwitcherOpen} setSessionSwitcherOpen={actions.setSessionSwitcherOpen}
sessionOwnerBySessionId={ownership.bySessionId} sessionOwnerBySessionId={ownership.bySessionId}
handleSessionSelect={selectSessionForProject} handleSessionSelect={selectSessionForProject}
@@ -113,8 +113,8 @@ const createProps = (): SessionGroupSectionProps => ({
resetGroupSessionLimit: () => undefined, resetGroupSessionLimit: () => undefined,
mobileVariant: false, mobileVariant: false,
alwaysShowActions: false, alwaysShowActions: false,
activeProjectId: null,
setActiveProjectIdOnly: () => undefined, setActiveProjectIdOnly: () => undefined,
setActiveMainTab: () => undefined,
setSessionSwitcherOpen: () => undefined, setSessionSwitcherOpen: () => undefined,
openNewSessionDraft: () => undefined, openNewSessionDraft: () => undefined,
pinnedSessionIds: new Set(), pinnedSessionIds: new Set(),
@@ -37,6 +37,7 @@ type SessionProjectScrollerGroupProps = Pick<SessionGroupSectionProps,
| 'hideDirectoryControls' | 'hideDirectoryControls'
| 'mobileVariant' | 'mobileVariant'
| 'alwaysShowActions' | 'alwaysShowActions'
| 'activeProjectId'
| 'notifyOnSubtasks' | 'notifyOnSubtasks'
| 'expandedParents' | 'expandedParents'
| 'editTitle' | 'editTitle'