From 11b407c804a462f840a6902c971ba7c20b3c453e Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Thu, 16 Apr 2026 13:14:00 +0700 Subject: [PATCH] fix(app): hide branch icon on non-git workspace headers Gate the GitBranch icon behind isGitCheckout, and keep the header skeleton visible until the checkout status query resolves so the icon doesn't pop in and cause layout shift. --- packages/app/src/components/branch-switcher.tsx | 2 +- .../app/src/screens/workspace/workspace-screen.tsx | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/app/src/components/branch-switcher.tsx b/packages/app/src/components/branch-switcher.tsx index aeef7b346..335cbe683 100644 --- a/packages/app/src/components/branch-switcher.tsx +++ b/packages/app/src/components/branch-switcher.tsx @@ -45,7 +45,7 @@ export function BranchSwitcher({ const titleContent = ( <> - + {isGitCheckout ? : null} {title} diff --git a/packages/app/src/screens/workspace/workspace-screen.tsx b/packages/app/src/screens/workspace/workspace-screen.tsx index 6054887d6..7deb16624 100644 --- a/packages/app/src/screens/workspace/workspace-screen.tsx +++ b/packages/app/src/screens/workspace/workspace-screen.tsx @@ -731,12 +731,13 @@ function WorkspaceScreenContent({ serverId, workspaceId }: WorkspaceScreenProps) }; }, [client, isConnected, normalizedWorkspaceId, queryClient, terminalsQueryKey]); + const isCheckoutQueryEnabled = + Boolean(client && isConnected) && + normalizedWorkspaceId.length > 0 && + isAbsolutePath(normalizedWorkspaceId); const checkoutQuery = useQuery({ queryKey: checkoutStatusQueryKey(normalizedServerId, normalizedWorkspaceId), - enabled: - Boolean(client && isConnected) && - normalizedWorkspaceId.length > 0 && - isAbsolutePath(normalizedWorkspaceId), + enabled: isCheckoutQueryEnabled, queryFn: async () => { if (!client) { throw new Error("Host is not connected"); @@ -745,6 +746,8 @@ function WorkspaceScreenContent({ serverId, workspaceId }: WorkspaceScreenProps) }, staleTime: 15_000, }); + const isCheckoutStatusLoading = + isCheckoutQueryEnabled && checkoutQuery.data === undefined && !checkoutQuery.isError; const workspaceDescriptor = useSessionStore( (state) => state.sessions[normalizedServerId]?.workspaces.get(normalizedWorkspaceId) ?? null, @@ -758,7 +761,7 @@ function WorkspaceScreenContent({ serverId, workspaceId }: WorkspaceScreenProps) const workspaceHeader = workspaceDescriptor ? resolveWorkspaceHeader({ workspace: workspaceDescriptor }) : null; - const isWorkspaceHeaderLoading = workspaceHeader === null; + const isWorkspaceHeaderLoading = workspaceHeader === null || isCheckoutStatusLoading; const workspaceHeaderTitle = workspaceHeader?.title ?? ""; const workspaceHeaderSubtitle = workspaceHeader?.subtitle ?? ""; const shouldShowWorkspaceHeaderSubtitle = !areHeaderLabelsEquivalent(