Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(control-ui): await GFS folder prefetch

Miguelon Peluchon5e9a10b6cadf
diff --git a/control-ui/components/GfsBrowser.tsx b/control-ui/components/GfsBrowser.tsx
index 2d3264958..42292eda0 100644
--- a/control-ui/components/GfsBrowser.tsx
+++ b/control-ui/components/GfsBrowser.tsx
@@ -235,23 +235,22 @@ export function GfsBrowser(): React.JSX.Element {
const folders = items.filter(child => child.kind === 'directory')
if (folders.length === 0) return
let cancelled = false
+ async function prefetchFolder(folder: GfsChild): Promise<void> {
+ try {
+ const page = (await apiGet(
+ `/api/v1/gfs/resources/${encodeURIComponent(folder.resourceId)}/children`,
+ { drive: DRIVE }
+ )) as TreePage | undefined
+ if (cancelled || !page) return
+ childCacheRef.current.set(folder.resourceId, page)
+ } catch {
+ /* ignore — openDirectory will surface the real error */
+ }
+ }
+
folders.forEach(folder => {
if (childCacheRef.current.has(folder.resourceId)) return
- const response = apiGet(
- `/api/v1/gfs/resources/${encodeURIComponent(folder.resourceId)}/children`,
- { drive: DRIVE }
- )
- if (!response || typeof (response as Promise<TreePage>).then !== 'function') {
- return
- }
- void (response as Promise<TreePage>)
- .then(page => {
- if (cancelled) return
- childCacheRef.current.set(folder.resourceId, page)
- })
- .catch(() => {
- /* ignore — openDirectory will surface the real error */
- })
+ void prefetchFolder(folder)
})
return () => {
cancelled = true