Skip to content

Commit 386cbef

Browse files
t3dotggclaude
andcommitted
fix(web): stop the composer context strip popping in after threads load
The strip under the composer (env mode, branch, resting controls) read the thread through useThread, which returns null until the full thread detail arrives. On a thread whose detail was not cached, the composer painted first and the strip mounted a moment later, pushing the composer up. Read the thread shell instead. Every field the strip and the header git control use lives on the shell, which is present before the route renders, and the merge helper already treats the shell as authoritative for branch, worktree, and project. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent bde39d4 commit 386cbef

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎apps/web/src/components/BranchToolbar.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useStat
1212

1313
import { useComposerDraftStore, type DraftId } from "../composerDraftStore";
1414
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
15-
import { useProject, useThread, useThreadShellsForProjectRefs } from "../state/entities";
15+
import { useProject, useThreadShell, useThreadShellsForProjectRefs } from "../state/entities";
1616
import {
1717
type EnvMode,
1818
type EnvironmentOption,
@@ -465,7 +465,7 @@ export const BranchToolbar = memo(function BranchToolbar({
465465
const draftThread = useComposerDraftStore((store) =>
466466
draftId ? store.getDraftSession(draftId) : store.getDraftThreadByRef(threadRef),
467467
);
468-
const serverThread = useThread(threadRef, { waitForShell: draftThread !== null });
468+
const serverThread = useThreadShell(threadRef);
469469
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
470470
const activeProjectRef = serverThread
471471
? scopeProjectRef(serverThread.environmentId, serverThread.projectId)

‎apps/web/src/components/BranchToolbarBranchSelector.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { readLocalApi } from "../localApi";
2727
import { useOpenPrLink } from "../lib/openPullRequestLink";
2828
import { shouldLoadNextBranchPageAfterScroll } from "../state/paginatedBranches";
2929
import { usePaginatedBranches } from "../state/queries";
30-
import { useProject, useThread } from "../state/entities";
30+
import { useProject, useThreadShell } from "../state/entities";
3131
import { useEnvironmentQuery } from "../state/query";
3232
import { threadEnvironment } from "../state/threads";
3333
import { useAtomCommand } from "../state/use-atom-command";
@@ -119,7 +119,7 @@ export function BranchToolbarBranchSelector({
119119
const draftThread = useComposerDraftStore((store) =>
120120
draftId ? store.getDraftSession(draftId) : store.getDraftThreadByRef(threadRef),
121121
);
122-
const serverThread = useThread(threadRef, { waitForShell: draftThread !== null });
122+
const serverThread = useThreadShell(threadRef);
123123
const serverSession = serverThread?.session ?? null;
124124
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
125125

‎apps/web/src/components/GitActionsControl.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ import {
8787
useVcsInitAction,
8888
useVcsPullAction,
8989
} from "~/lib/sourceControlActions";
90-
import { useThread } from "~/state/entities";
90+
import { useThreadShell } from "~/state/entities";
9191
import { useEnvironmentQuery } from "~/state/query";
9292
import { serverEnvironment } from "~/state/server";
9393
import { sourceControlEnvironment } from "~/state/sourceControl";
@@ -1009,9 +1009,7 @@ export default function GitActionsControl({
10091009
? store.getDraftThreadByRef(activeThreadRef)
10101010
: null,
10111011
);
1012-
const activeServerThread = useThread(activeThreadRef, {
1013-
waitForShell: activeDraftThread !== null,
1014-
});
1012+
const activeServerThread = useThreadShell(activeThreadRef);
10151013
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
10161014
const [isCommitDialogOpen, setIsCommitDialogOpen] = useState(false);
10171015
const [dialogCommitMessage, setDialogCommitMessage] = useState("");

0 commit comments

Comments
 (0)