fix(workspace): restore View button functionality and clean up dead props

Fix two issues identified in code review:

1. Critical: onViewFromHistory was a silent no-op. Now navigates to the
   SessionDetail page using the same route pattern as the external link in
   RunHistory, allowing users to view a finished run's transcript.

2. Important: Removed dead slashCommands={[]} prop from RunSetup invocation.
   Made slashCommands optional in RunSetupProps to maintain type safety while
   reflecting that the discovery logic was removed.

All tests pass (396 client, 1152 server).
This commit is contained in:
2026-08-12 16:20:02 +07:00
parent cb8800fa31
commit d581705eb0
2 changed files with 13 additions and 10 deletions
+2 -2
View File
@@ -112,7 +112,7 @@ interface RunSetupProps {
* sessions. Undefined when no lane is selected (the picker then lists
* everything, same as before lanes existed). */
laneCwd?: string;
slashCommands: SlashCommand[];
slashCommands?: SlashCommand[];
runHistory: DashboardRunHistoryItem[];
onResumeFromHistory: (item: DashboardRunHistoryItem) => void;
}
@@ -172,7 +172,7 @@ export function RunSetup(props: RunSetupProps) {
onSubmit={() => handleStart(props)}
placeholder={t("fields.promptPlaceholderTerminal")}
rows={5}
slashCommands={props.slashCommands}
slashCommands={props.slashCommands ?? []}
fileCwd={props.resumeSession?.cwd || props.cwd}
/>
<div className="mt-1 text-[10px] text-fg-muted">
+11 -8
View File
@@ -38,7 +38,7 @@
* ----------------------------------------------------------------------------- */
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
import { useSearchParams } from "react-router-dom";
import { useSearchParams, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Play, AlertCircle, X, Plus } from "lucide-react";
import { api } from "../lib/api";
@@ -307,12 +307,16 @@ export function Workspace() {
[busy, refreshList, t, lanes]
);
// View a past run inline: not implemented in the new TerminalView architecture.
// The old RunConsole showed transcripts inline, but TerminalView only shows live
// runs. Use SessionDetail page instead.
const onViewFromHistory = useCallback(() => {
// No-op: feature moved to SessionDetail page
}, []);
// View a past run: navigate to the SessionDetail page which shows the transcript.
const navigate = useNavigate();
const onViewFromHistory = useCallback(
(item: DashboardRunHistoryItem) => {
if (item.session_id) {
navigate(`/sessions/${encodeURIComponent(item.session_id)}`);
}
},
[navigate]
);
const start = useCallback(async () => {
if (!prompt.trim() || busy) return;
@@ -802,7 +806,6 @@ export function Workspace() {
laneCwd={currentLane?.cwd}
resumeSession={resumeSession}
onResumeSessionChange={setResumeSession}
slashCommands={[]}
runHistory={runHistory}
onResumeFromHistory={onResumeFromHistory}
/>