Skip to content

Commit 97d0401

Browse files
committed
fix(web): warning and error notices also stay visible above activity
Only urgent notices stayed expanded, so a plain warning like the server reconnecting banner still collapsed behind a goal or subagent banner (#19455). Every notice in the urgent, warning and error tier now keeps its place above the front item. Info and default notices still collapse.
1 parent e0b1ed5 commit 97d0401

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎apps/web/src/components/chat/ComposerBannerStack.browser.test.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const titles = (scope: ParentNode) =>
6565
(title) => title.textContent,
6666
);
6767

68-
it("keeps an urgent notice out of the collapsed stack behind activity", async () => {
68+
it("keeps urgent, warning and error notices out of the collapsed stack behind activity", async () => {
6969
await act(async () =>
7070
root.render(
7171
<ComposerBannerStack
@@ -78,6 +78,8 @@ it("keeps an urgent notice out of the collapsed stack behind activity", async ()
7878
title: "Usage limit reached",
7979
},
8080
{ id: "usage", variant: "info", priority: "notice", icon: null, title: "Usage limits" },
81+
{ id: "offline", variant: "warning", icon: null, title: "Server is reconnecting" },
82+
{ id: "clone", variant: "error", icon: null, title: "Failed to clone repo" },
8183
{
8284
id: "work",
8385
variant: "default",
@@ -92,6 +94,8 @@ it("keeps an urgent notice out of the collapsed stack behind activity", async ()
9294
// Order is unchanged: activity stays attached, with the notices above it.
9395
expect(titles(container)).toEqual([
9496
"Usage limit reached",
97+
"Server is reconnecting",
98+
"Failed to clone repo",
9599
"Usage limits",
96100
"Waiting on 2 subagents",
97101
]);

‎apps/web/src/components/chat/ComposerBannerStack.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ export function ComposerBannerStack({ className, items, attachedAbove }: Compose
7171
const orderedItems = items.toSorted((a, b) => bannerPriority(a) - bannerPriority(b));
7272
const frontItem = orderedItems[0];
7373
const stackedItems = orderedItems.slice(1);
74-
// An urgent notice is waiting on the user, so it keeps its expanded place above the
75-
// front item instead of collapsing behind it with the other notices.
76-
const pinnedItems = stackedItems.filter((item) => item.priority === "urgent");
77-
const collapsedItems = stackedItems.filter((item) => item.priority !== "urgent");
74+
// Urgent, warning and error notices need the user, so they keep their expanded place
75+
// above the front item instead of collapsing behind it with the other notices.
76+
const pinnedItems = stackedItems.filter((item) => bannerPriority(item) === 1);
77+
const collapsedItems = stackedItems.filter((item) => bannerPriority(item) !== 1);
7878
const hasStack = collapsedItems.length > 0;
7979

8080
// A stack with nothing left to collapse closes, so the next stack starts collapsed.

0 commit comments

Comments
 (0)