From 9ccad00888f26b7c49a8d53645867dc682d867e3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 7 Jan 2026 19:18:34 -0600 Subject: [PATCH] Reset state of GitSyncButton when navigating between projects --- src/components/git-sync/GitSyncButton.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/git-sync/GitSyncButton.tsx b/src/components/git-sync/GitSyncButton.tsx index 2b2f7ee9..50318c7d 100644 --- a/src/components/git-sync/GitSyncButton.tsx +++ b/src/components/git-sync/GitSyncButton.tsx @@ -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(() => {