diff --git a/web/src/FileManager.tsx b/web/src/FileManager.tsx index 7892005..20caf02 100644 --- a/web/src/FileManager.tsx +++ b/web/src/FileManager.tsx @@ -28,11 +28,13 @@ export function FileManager({ torrentId, zipUrl }: { torrentId: number; zipUrl?: const [entries, setEntries] = useState([]) const [error, setError] = useState('') const [busy, setBusy] = useState(false) + const [loading, setLoading] = useState(true) const [progress, setProgress] = useState('') const [selected, setSelected] = useState>(new Map()) // path -> is_dir const load = useCallback( async (path: string) => { + setLoading(true) try { const res = await api.listFiles(torrentId, path) setDir(res.path) @@ -40,6 +42,8 @@ export function FileManager({ torrentId, zipUrl }: { torrentId: number; zipUrl?: setError('') } catch (err) { setError(err instanceof Error ? err.message : 'Could not list files') + } finally { + setLoading(false) } }, [torrentId], @@ -157,7 +161,9 @@ export function FileManager({ torrentId, zipUrl }: { torrentId: number; zipUrl?: ) })} - {entries.length === 0 ?
  • Empty
  • : null} + {entries.length === 0 ? ( +
  • {loading ? 'Loading...' : 'Empty'}
  • + ) : null} )