(dirPath: string)
| 27 | }, [sessionId]); |
| 28 | |
| 29 | const loadDirectory = async (dirPath: string) => { |
| 30 | try { |
| 31 | const response = await fetch( |
| 32 | `/api/container/${sessionId}/files?path=${encodeURIComponent(dirPath)}` |
| 33 | ); |
| 34 | |
| 35 | if (!response.ok) { |
| 36 | throw new Error("Failed to load directory"); |
| 37 | } |
| 38 | |
| 39 | const entries: FileEntry[] = await response.json(); |
| 40 | |
| 41 | // Add entries to files list (avoid duplicates) |
| 42 | setFiles((prev) => { |
| 43 | const newFiles = [...prev]; |
| 44 | for (const entry of entries) { |
| 45 | if (!newFiles.some((f) => f.path === entry.path)) { |
| 46 | newFiles.push(entry); |
| 47 | } |
| 48 | } |
| 49 | return newFiles; |
| 50 | }); |
| 51 | |
| 52 | setLoading(false); |
| 53 | } catch (err) { |
| 54 | setError(err instanceof Error ? err.message : "Failed to load directory"); |
| 55 | setLoading(false); |
| 56 | } |
| 57 | }; |
| 58 | |
| 59 | const toggleDirectory = async (dirPath: string) => { |
| 60 | const newExpanded = new Set(expandedDirs); |
no outgoing calls
no test coverage detected