Reset state of GitSyncButton when navigating between projects

This commit is contained in:
Alex Gleason committed 2026-01-07 19:18:34 -06:00
1 parent 32ff6570cf
commit 9ccad00888
1 file changed
+12
+12
View File
@@ -28,6 +28,18 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
const gitSyncState = getState(dir);
const isGitActionOccurring = gitSyncState?.isActive ?? false;
const prevIsGitActionOccurring = useRef(isGitActionOccurring);
const prevProjectId = useRef(projectId);
// Reset state when projectId changes
useEffect(() => {
if (prevProjectId.current !== projectId) {
setSyncSuccess(false);
setShowWarningPopover(false);
warningDismissed.current = false;
prevIsGitActionOccurring.current = isGitActionOccurring;
prevProjectId.current = projectId;
}
}, [projectId, isGitActionOccurring]);
// Detect when a git action completes successfully
useEffect(() => {