Skip to content
TypeScript

fix(web): many automations no longer hide the thread details Automations section (#28585)

Igor Makowski46e90bad0d7a
diff --git a/apps/web/src/components/chat/ThreadAutomationsPanel.tsx b/apps/web/src/components/chat/ThreadAutomationsPanel.tsx
index 30eade3d813..4c3326df8c6 100644
--- a/apps/web/src/components/chat/ThreadAutomationsPanel.tsx
+++ b/apps/web/src/components/chat/ThreadAutomationsPanel.tsx
@@ -155,7 +155,7 @@ export function ThreadAutomationsPanel(props: {
</Tooltip>
}
>
- <ul className="m-0 list-none p-0">
+ <ul className="m-0 max-h-[13.5rem] list-none overflow-y-auto p-0">
{boundTasks.map((task) => (
<li
key={task.id}
diff --git a/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx b/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx
index a8728d7879d..673fe94ee10 100644
--- a/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx
+++ b/apps/web/src/components/chat/ThreadDetailsCard.browser.test.tsx
@@ -43,12 +43,15 @@ function Card({
inline,
fixture,
rows = 1,
+ automationRows = 0,
}: {
threadRef: ScopedThreadRef;
inline: boolean;
fixture: ReturnType<typeof setup>;
/** Rows of 100px shown at full density. Compact always takes 50px. */
rows?: number;
+ /** Rows of 100px in an automations list shown at full density. */
+ automationRows?: number;
}) {
return (
// The web root renders in StrictMode, which re-runs ref callbacks on every mount.
@@ -73,9 +76,14 @@ function Card({
contentKey={String(rows)}
>
{(density) => (
- <p style={{ height: density === "full" ? rows * 100 : 50 }}>
- Details for {threadRef.threadId}
- </p>
+ <>
+ <p style={{ height: density === "full" ? rows * 100 : 50 }}>
+ Details for {threadRef.threadId}
+ </p>
+ {density === "full" && automationRows > 0 ? (
+ <section data-thread-automations-panel style={{ height: automationRows * 100 }} />
+ ) : null}
+ </>
)}
</ThreadDetailsCard>
</ChatCanvasContext>
@@ -158,3 +166,14 @@ it("returns to full density when hidden items make the content fit", async () =>
await screen.rerender(<Card threadRef={threadB} inline fixture={fixture} rows={2} />);
await expect.element(card).toHaveAttribute("data-density", "full");
});
+
+it("keeps full density when many automations make the content tall", async () => {
+ using fixture = setup();
+ await using _screen = await render(
+ <Card threadRef={threadB} inline fixture={fixture} rows={2} automationRows={6} />,
+ );
+ await expect.element(page.getByText("Details for thread-b")).toBeVisible();
+ await expect
+ .element(page.getByRole("region", { name: "Thread details" }))
+ .toHaveAttribute("data-density", "full");
+});
diff --git a/apps/web/src/components/chat/ThreadDetailsCard.tsx b/apps/web/src/components/chat/ThreadDetailsCard.tsx
index 9ffbc90de75..969172c77a9 100644
--- a/apps/web/src/components/chat/ThreadDetailsCard.tsx
+++ b/apps/web/src/components/chat/ThreadDetailsCard.tsx
@@ -78,10 +78,10 @@ export function ThreadDetailsCard({
const measure = () => {
const frame = element.closest<HTMLElement>("[data-thread-details-card]");
const next = element.offsetHeight + (frame ? frame.offsetHeight - frame.clientHeight : 0);
- // PR lists, lineage and side chats scroll as they expand. Counting them toward density
- // would hide the section and workspace controls when the user asks to see more rows.
+ // PR lists, lineage, side chats and automations scroll as they grow. Counting them toward
+ // density would hide the section and workspace controls when the user asks to see more rows.
const lists = element.querySelectorAll<HTMLElement>(
- "[data-thread-relationships-panel], [data-thread-side-chats-panel], [data-thread-details-pr-list]",
+ "[data-thread-relationships-panel], [data-thread-side-chats-panel], [data-thread-details-pr-list], [data-thread-automations-panel]",
);
const fittingHeight =
next - Array.from(lists).reduce((sum, list) => sum + list.offsetHeight, 0);