fix: open subtasks as sessions on mobile and VS Code
Restores session navigation for subtask links on mobile Keeps desktop subtask links opening in the context panel
This commit is contained in:
@@ -45,6 +45,7 @@ import { useEffectiveDirectory } from '@/hooks/useEffectiveDirectory';
|
||||
import { useSessions } from '@/sync/sync-context';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
import { extractLoopbackUrls } from '@/lib/url';
|
||||
import { useDeviceInfo } from '@/lib/device';
|
||||
|
||||
|
||||
const CONTAIN_LAYOUT_STYLE = { contain: 'layout' as const, transform: 'translateZ(0)' };
|
||||
@@ -93,6 +94,8 @@ const normalizeSubtaskModel = (model: SubtaskPartLike['model']): string | null =
|
||||
const UserSubtaskPart: React.FC<{ part: SubtaskPartLike }> = ({ part }) => {
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
const effectiveDirectory = useEffectiveDirectory();
|
||||
const { isMobile } = useDeviceInfo();
|
||||
const setCurrentSession = useSessionUIStore((state) => state.setCurrentSession);
|
||||
const openContextPanelTab = useUIStore((state) => state.openContextPanelTab);
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -154,6 +157,11 @@ const UserSubtaskPart: React.FC<{ part: SubtaskPartLike }> = ({ part }) => {
|
||||
className="typography-meta text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2"
|
||||
onClick={() => {
|
||||
if (!effectiveDirectory) return;
|
||||
if (isMobile || isVSCodeRuntime()) {
|
||||
setCurrentSession(taskSessionID, effectiveDirectory);
|
||||
return;
|
||||
}
|
||||
|
||||
openContextPanelTab(effectiveDirectory, {
|
||||
mode: 'chat',
|
||||
dedupeKey: `session:${taskSessionID}`,
|
||||
|
||||
@@ -1085,8 +1085,10 @@ const TaskToolSummary: React.FC<{
|
||||
}> = ({ entries, isExpanded, isMobile, output, sessionId, onShowPopup, input, animateTailText = true, isActive = false }) => {
|
||||
const { t } = useI18n();
|
||||
const currentDirectory = useDirectoryStore((state) => state.currentDirectory);
|
||||
const setCurrentSession = useSessionUIStore((state) => state.setCurrentSession);
|
||||
const openContextPanelTab = useUIStore((state) => state.openContextPanelTab);
|
||||
const showToolFileIcons = useUIStore((state) => state.showToolFileIcons);
|
||||
const runtime = React.useContext(RuntimeAPIContext);
|
||||
const displayEntries = entries;
|
||||
|
||||
const trimmedOutput = typeof output === 'string'
|
||||
@@ -1098,6 +1100,11 @@ const TaskToolSummary: React.FC<{
|
||||
const handleOpenSession = (event: React.MouseEvent) => {
|
||||
event.stopPropagation();
|
||||
if (sessionId && currentDirectory) {
|
||||
if (isMobile || runtime?.runtime.isVSCode) {
|
||||
setCurrentSession(sessionId, currentDirectory);
|
||||
return;
|
||||
}
|
||||
|
||||
openContextPanelTab(currentDirectory, {
|
||||
mode: 'chat',
|
||||
dedupeKey: `session:${sessionId}`,
|
||||
|
||||
Reference in New Issue
Block a user