fix(tui): tighten expanded instruction group spacing (#52311)

This commit is contained in:
OpeOginni
2026-09-30 17:08:01 +02:00
committed by GitHub
parent 02c3891d9b
commit 9388b94a97
2 changed files with 50 additions and 3 deletions
@@ -260,9 +260,7 @@ function InstructionsGroup(props: GroupProps) {
Instructions: {files()} {files() === 1 ? "file" : "files"}
</InlineToolRow>
<Show when={disclosure.expanded()}>
<box flexDirection="column" gap={1} marginTop={1}>
<Children {...props} nodes={props.node.children} mode="normal" />
</box>
<Children {...props} nodes={props.node.children} mode="normal" />
</Show>
</GroupAnchor>
)
@@ -153,6 +153,55 @@ test("retains nested expansion state and registers exact headers and parts", asy
expect(anchors.list()).toEqual([])
})
test("expanded instructions stay adjacent to their summary and each other", async () => {
const anchors = createTimelineAnchors()
const [expanded, setExpanded] = createStore<Record<string, boolean>>({})
const messages: SessionMessageInfo[] = ["AGENTS.md", "packages/tui/AGENTS.md"].map((path) => ({
type: "synthetic",
id: path,
text: "Instructions",
description: `Loaded ${path}`,
metadata: { instruction: { paths: [path] } },
time: { created: 1 },
}))
const row: SessionGroup = {
type: "group",
kind: "instructions",
size: messages.length,
completed: true,
children: messages.map((message) => ({
type: "entry",
size: 1,
entry: { type: "message", messageID: message.id },
})),
}
const app = await mount({
row,
anchors,
config: createTuiResolvedConfig({ animations: false }),
expanded: (id) => expanded[id],
setExpanded: (id, value) => setExpanded(id, value),
message: (id) => messages.find((message) => message.id === id),
entry: (entry) => <text>{entry.type === "message" ? `Loaded ${entry.messageID}` : ""}</text>,
})
try {
app.renderer.start()
await app.waitForFrame((frame) => frame.includes("Instructions: 2 files"))
expect(app.captureCharFrame()).not.toContain("Loaded AGENTS.md")
await app.mockMouse.click(4, anchors.get({ type: "group", groupID: groupID(row, 0)! })?.node.y ?? -1)
await app.renderOnce()
expect(
app
.captureCharFrame()
.split("\n")
.map((line) => line.trim())
.join("\n"),
).toContain("◈ Instructions: 2 files\nLoaded AGENTS.md\nLoaded packages/tui/AGENTS.md")
} finally {
app.renderer.destroy()
}
})
test("a low activity group with nothing finished stays collapsed behind a status", async () => {
const config = createTuiResolvedConfig({ animations: false })
const shell = (id: string) => ({