Skip to content
TypeScript

fix(web): stop the bar under the composer popping in after threads load (#10727)

Theo Brownede545c41737a
diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx
index d0207b90115..3e3f834658e 100644
--- a/apps/web/src/components/BranchToolbar.tsx
+++ b/apps/web/src/components/BranchToolbar.tsx
@@ -12,7 +12,7 @@ import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useStat
import { useComposerDraftStore, type DraftId } from "../composerDraftStore";
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
-import { useProject, useThread, useThreadShellsForProjectRefs } from "../state/entities";
+import { useProject, useThreadShell, useThreadShellsForProjectRefs } from "../state/entities";
import {
type EnvMode,
type EnvironmentOption,
@@ -465,7 +465,7 @@ export const BranchToolbar = memo(function BranchToolbar({
const draftThread = useComposerDraftStore((store) =>
draftId ? store.getDraftSession(draftId) : store.getDraftThreadByRef(threadRef),
);
- const serverThread = useThread(threadRef, { waitForShell: draftThread !== null });
+ const serverThread = useThreadShell(threadRef);
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
const activeProjectRef = serverThread
? scopeProjectRef(serverThread.environmentId, serverThread.projectId)
diff --git a/apps/web/src/components/BranchToolbarBranchSelector.tsx b/apps/web/src/components/BranchToolbarBranchSelector.tsx
index 0dad406985a..e9b5360cbc4 100644
--- a/apps/web/src/components/BranchToolbarBranchSelector.tsx
+++ b/apps/web/src/components/BranchToolbarBranchSelector.tsx
@@ -27,7 +27,7 @@ import { readLocalApi } from "../localApi";
import { useOpenPrLink } from "../lib/openPullRequestLink";
import { shouldLoadNextBranchPageAfterScroll } from "../state/paginatedBranches";
import { usePaginatedBranches } from "../state/queries";
-import { useProject, useThread } from "../state/entities";
+import { useProject, useThreadShell } from "../state/entities";
import { useEnvironmentQuery } from "../state/query";
import { threadEnvironment } from "../state/threads";
import { useAtomCommand } from "../state/use-atom-command";
@@ -119,7 +119,7 @@ export function BranchToolbarBranchSelector({
const draftThread = useComposerDraftStore((store) =>
draftId ? store.getDraftSession(draftId) : store.getDraftThreadByRef(threadRef),
);
- const serverThread = useThread(threadRef, { waitForShell: draftThread !== null });
+ const serverThread = useThreadShell(threadRef);
const serverSession = serverThread?.session ?? null;
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsx
index b766a846931..c575f270f0b 100644
--- a/apps/web/src/components/GitActionsControl.tsx
+++ b/apps/web/src/components/GitActionsControl.tsx
@@ -87,7 +87,7 @@ import {
useVcsInitAction,
useVcsPullAction,
} from "~/lib/sourceControlActions";
-import { useThread } from "~/state/entities";
+import { useThreadShell } from "~/state/entities";
import { useEnvironmentQuery } from "~/state/query";
import { serverEnvironment } from "~/state/server";
import { sourceControlEnvironment } from "~/state/sourceControl";
@@ -950,9 +950,7 @@ export default function GitActionsControl({
? store.getDraftThreadByRef(activeThreadRef)
: null,
);
- const activeServerThread = useThread(activeThreadRef, {
- waitForShell: activeDraftThread !== null,
- });
+ const activeServerThread = useThreadShell(activeThreadRef);
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
const [isCommitDialogOpen, setIsCommitDialogOpen] = useState(false);
const [dialogCommitMessage, setDialogCommitMessage] = useState("");