feat: Clear file changes state when the task path changes and display…#862
feat: Clear file changes state when the task path changes and display…#862arnestrickmann merged 3 commits intogeneralaction:mainfrom
Conversation
… a loading spinner in the file changes panel.
|
@prath47 is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Greptile OverviewGreptile SummaryFixed stale file changes displaying when switching between tasks by immediately clearing the file changes state when
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/renderer/hooks/useFileChanges.ts | Added immediate state clearing when taskPath changes to prevent showing stale file changes from the previous task |
| src/renderer/components/FileChangesPanel.tsx | Destructured isLoading from useFileChanges hook and added loading spinner display when loading with no file changes |
Flowchart
flowchart TD
A[Task Path Changes] --> B[useEffect triggered in useFileChanges]
B --> C[setFileChanges clears array]
B --> D[taskPathRef.current = taskPath]
B --> E[hasLoadedRef.current = false]
C --> F[Component re-renders]
D --> G[Second useEffect triggered]
E --> G
G --> H{taskPath && shouldPoll?}
H -->|Yes| I[fetchFileChanges with isInitialLoad=true]
H -->|No| J[clearIdleHandle and return]
I --> K[setIsLoading true]
I --> L[Call getCachedGitStatus]
L --> M{Request successful?}
M -->|Yes| N[setFileChanges with new data]
M -->|No| O[setFileChanges with empty array]
N --> P[setIsLoading false]
O --> P
F --> Q{isLoading && fileChanges.length === 0?}
Q -->|Yes| R[Show Spinner]
Q -->|No| S[Show file changes list]
P --> T[Component updates with new state]
Last reviewed commit: 6c0d183
|
@arnestrickmann Please help here |
|
Hi @prath47, thanks for opening this PR and for catching this issue! One thing: Can you add a screen recording showing the spinner on task switch? Also, please add setIsLoading(true) in the same effect as the setFileChanges([]) clear — without it there's a blank frame before the spinner kicks in: useEffect(() => { When this is fixed, happy to merge this |
|
@arnestrickmann I think this would suit better than just adding setIsLoading(true); |
|
Sounds good |
|
thanks! @prath47 |
|
tested, lgtm! |
Fix: #777
This PR includes changes as per:
Check Performed