MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / ResumeTask

Function ResumeTask

src/components/ResumeTask.tsx:28–247  ·  view source on GitHub ↗
({ onSelect, onCancel, isEmbedded = false }: Props)

Source from the content-addressed store, hash-verified

26const SPACE_BETWEEN_TABLE_COLUMNS = ' ';
27
28export function ResumeTask({ onSelect, onCancel, isEmbedded = false }: Props): React.ReactNode {
29 const { rows } = useTerminalSize();
30 const [sessions, setSessions] = useState<CodeSession[]>([]);
31 const [currentRepo, setCurrentRepo] = useState<string | null>(null);
32
33 const [loading, setLoading] = useState(true);
34 const [loadErrorType, setLoadErrorType] = useState<LoadErrorType | null>(null);
35 const [retrying, setRetrying] = useState(false);
36
37 const [hasCompletedTeleportErrorFlow, setHasCompletedTeleportErrorFlow] = useState(false);
38
39 // Track focused index for scroll position display in title
40 const [focusedIndex, setFocusedIndex] = useState(1);
41
42 const escKey = useShortcutDisplay('confirm:no', 'Confirmation', 'Esc');
43
44 const loadSessions = useCallback(async () => {
45 try {
46 setLoading(true);
47 setLoadErrorType(null);
48
49 // Detect current repository
50 const detectedRepo = await detectCurrentRepository();
51 setCurrentRepo(detectedRepo);
52 logForDebugging(`Current repository: ${detectedRepo || 'not detected'}`);
53
54 const codeSessions = await fetchCodeSessionsFromSessionsAPI();
55
56 // Filter sessions by current repository if detected
57 let filteredSessions = codeSessions;
58 if (detectedRepo) {
59 filteredSessions = codeSessions.filter(session => {
60 if (!session.repo) return false;
61 const sessionRepo = `${session.repo.owner.login}/${session.repo.name}`;
62 return sessionRepo === detectedRepo;
63 });
64 logForDebugging(
65 `Filtered ${filteredSessions.length} sessions for repo ${detectedRepo} from ${codeSessions.length} total`,
66 );
67 }
68
69 // Sort by updated_at (newest first)
70 const sortedSessions = [...filteredSessions].sort((a, b) => {
71 const dateA = new Date(a.updated_at);
72 const dateB = new Date(b.updated_at);
73 return dateB.getTime() - dateA.getTime();
74 });
75
76 setSessions(sortedSessions);
77 } catch (err) {
78 const errorMessage = err instanceof Error ? err.message : String(err);
79 logForDebugging(`Error loading code sessions: ${errorMessage}`);
80 setLoadErrorType(determineErrorType(errorMessage));
81 } finally {
82 setLoading(false);
83 setRetrying(false);
84 }
85 }, []);

Callers

nothing calls this directly

Calls 14

useInputFunction · 0.90
useTerminalSizeFunction · 0.85
useShortcutDisplayFunction · 0.85
detectCurrentRepositoryFunction · 0.85
determineErrorTypeFunction · 0.85
useKeybindingFunction · 0.85
handleRetryFunction · 0.85
maxMethod · 0.80
logForDebuggingFunction · 0.50
onCancelFunction · 0.50

Tested by

no test coverage detected