Fix file explorer back loader
This commit is contained in:
@@ -1603,6 +1603,7 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
|
|||||||
pendingRequest: { path: targetPath, mode: "list" },
|
pendingRequest: { path: targetPath, mode: "list" },
|
||||||
currentPath: targetPath,
|
currentPath: targetPath,
|
||||||
history: nextHistory,
|
history: nextHistory,
|
||||||
|
lastVisitedPath: targetPath,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1610,18 +1611,38 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const msg: WSInboundMessage = {
|
directoryListingRequest
|
||||||
type: "session",
|
.execute({ agentId, path: targetPath })
|
||||||
message: {
|
.then((payload) => {
|
||||||
type: "file_explorer_request",
|
updateExplorerState(agentId, (state: any) => {
|
||||||
agentId,
|
const nextState: any = {
|
||||||
path: targetPath,
|
...state,
|
||||||
mode: "list",
|
isLoading: false,
|
||||||
},
|
lastError: payload.error ?? null,
|
||||||
};
|
pendingRequest: null,
|
||||||
ws.send(msg);
|
directories: state.directories,
|
||||||
|
files: state.files,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!payload.error && payload.directory) {
|
||||||
|
const directories = new Map(state.directories);
|
||||||
|
directories.set(payload.directory.path, payload.directory);
|
||||||
|
nextState.directories = directories;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextState;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
updateExplorerState(agentId, (state: any) => ({
|
||||||
|
...state,
|
||||||
|
isLoading: false,
|
||||||
|
lastError: error.message,
|
||||||
|
pendingRequest: null,
|
||||||
|
}));
|
||||||
|
});
|
||||||
return targetPath;
|
return targetPath;
|
||||||
}, [updateExplorerState, ws]);
|
}, [directoryListingRequest, updateExplorerState]);
|
||||||
|
|
||||||
const refreshSession = useCallback(() => {
|
const refreshSession = useCallback(() => {
|
||||||
console.log(`[Session] Manual refresh requested for ${serverId}`);
|
console.log(`[Session] Manual refresh requested for ${serverId}`);
|
||||||
|
|||||||
@@ -74,10 +74,11 @@ Improvements to the new agent screen in the app.
|
|||||||
- Image timeouts should never crash the entire view.
|
- Image timeouts should never crash the entire view.
|
||||||
- **Done (2025-12-29 00:01)**: WHAT: `packages/app/src/contexts/session-context.tsx:1550-1584` stops updating `lastError` during file preview requests so thumbnail timeouts no longer trigger the full-screen error state. RESULT: gallery image timeouts no longer replace the directory view; thumbnails remain in loading state. EVIDENCE: Not run (not requested).
|
- **Done (2025-12-29 00:01)**: WHAT: `packages/app/src/contexts/session-context.tsx:1550-1584` stops updating `lastError` during file preview requests so thumbnail timeouts no longer trigger the full-screen error state. RESULT: gallery image timeouts no longer replace the directory view; thumbnails remain in loading state. EVIDENCE: Not run (not requested).
|
||||||
|
|
||||||
- [ ] **Iteration 7**: Fix spurious loader showing at top of gallery even when directory has loaded.
|
- [x] **Iteration 7**: Fix spurious loader showing at top of gallery even when directory has loaded.
|
||||||
|
|
||||||
- Sometimes the loader at the top of the gallery keeps showing even when the directory content has clearly loaded.
|
- Sometimes the loader at the top of the gallery keeps showing even when the directory content has clearly loaded.
|
||||||
- Investigate the loading state management and fix the race condition.
|
- Investigate the loading state management and fix the race condition.
|
||||||
|
- **Done (2025-12-29 00:10)**: WHAT: `packages/app/src/contexts/session-context.tsx:1588-1645` routes back-navigation directory listings through the request helper and clears `pendingRequest`/`isLoading` on response. RESULT: gallery header loader no longer sticks after navigating back to cached directories. EVIDENCE: Not run (not requested).
|
||||||
|
|
||||||
- [ ] **Iteration 8**: Review and fix file/directory auto-linking logic.
|
- [ ] **Iteration 8**: Review and fix file/directory auto-linking logic.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user