mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-03-04 05:27:40 +00:00
fix(file-tree): clear loading when selected project is removed mid-fetch
Problem The file tree hook returned early when selectedProject?.name became falsy, but only cleared files. If a fetch had already set loading=true and was then aborted by cleanup, that early return path could leave loading stuck true. Root cause The !projectName branch in useFileTreeData exited before setting loading=false, while the in-flight request's finally block was guarded by isActive and therefore skipped after cleanup marked isActive=false. Change - Updated the early-return path to call setLoading(false) immediately before returning. - Kept existing abortController cleanup behavior unchanged. - Kept existing isActive guards in try/catch/finally unchanged. Result Clearing the selected project now deterministically resets loading state, preventing stale loading UI after project deletion/clear during an in-flight file-tree fetch.
This commit is contained in:
@@ -17,6 +17,7 @@ export function useFileTreeData(selectedProject: Project | null): UseFileTreeDat
|
|||||||
|
|
||||||
if (!projectName) {
|
if (!projectName) {
|
||||||
setFiles([]);
|
setFiles([]);
|
||||||
|
setLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user