Skip to content

Commit 7803378

Browse files
committed
fix(web): measure visible composer shoulder tab
1 parent 183dd2d commit 7803378

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

‎apps/web/src/components/ChatView.logic.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ describe("shoulderTabReserve", () => {
5959
} as HTMLElement;
6060

6161
expect(shoulderTabReserve(overlay)).toBe(28);
62+
elements.set(".chat-composer-tasks-tab", elementAt(100));
63+
expect(shoulderTabReserve(overlay)).toBe(0);
6264
});
6365
});
6466

‎apps/web/src/components/ChatView.logic.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const ENVIRONMENT_RECONNECT_WARNING_GRACE_MS = 2_000;
4040
export const LastInvokedScriptByProjectSchema = Schema.Record(ProjectId, Schema.String);
4141

4242
export function shoulderTabReserve(overlay: HTMLElement): number {
43+
if (overlay.querySelector(".chat-composer-tasks-tab")) return 0;
4344
const tab = overlay.querySelector<HTMLElement>(".chat-composer-shoulder-tab");
4445
const surface = overlay.querySelector<HTMLElement>('[data-chat-composer-main-surface="true"]');
4546
if (!tab || !surface) return 0;

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4450,8 +4450,6 @@ function ChatViewContent(props: ChatViewProps) {
44504450
activeComposerTasksProgress && activePlan && activePlan.turnId === activeLatestTurn?.turnId
44514451
? activePlan.steps
44524452
: null;
4453-
const hasWideShoulderTab =
4454-
activeComposerTasksProgress !== null && activeComposerTaskSteps !== null;
44554453

44564454
useLayoutEffect(() => {
44574455
if (!composerOverlayElement) return;
@@ -4462,9 +4460,7 @@ function ChatViewContent(props: ChatViewProps) {
44624460
setComposerOverlayHeight((currentHeight) =>
44634461
currentHeight === nextHeight ? currentHeight : nextHeight,
44644462
);
4465-
const nextClearance = hasWideShoulderTab
4466-
? nextHeight
4467-
: Math.max(0, nextHeight - shoulderTabReserve(composerOverlayElement));
4463+
const nextClearance = Math.max(0, nextHeight - shoulderTabReserve(composerOverlayElement));
44684464
setScrollToEndClearance((currentClearance) =>
44694465
currentClearance === nextClearance ? currentClearance : nextClearance,
44704466
);
@@ -4476,7 +4472,7 @@ function ChatViewContent(props: ChatViewProps) {
44764472
const observer = new ResizeObserver(updateHeight);
44774473
observer.observe(composerOverlayElement);
44784474
return () => observer.disconnect();
4479-
}, [composerOverlayElement, hasWideShoulderTab]);
4475+
}, [composerOverlayElement]);
44804476

44814477
const autoSettleAfterDays = useClientSettings((settings) => settings.sidebarAutoSettleAfterDays);
44824478
const autoSettleOnMerge = useClientSettings((settings) => settings.sidebarAutoSettleOnMerge);

0 commit comments

Comments
 (0)