fix(coach): keep the chart on "as a table" so the chart is offered back

"As a table" used to drop the table's chart, so the reply offered no way
back to it. The copied table now keeps its chart and carries view: table,
which the panel opens on the table (the chart one tap away on the toggle)
and the chips read to offer "as a chart". show_result with view table
does the same. The field is optional on the result metadata; a client
that ignores it shows the chart first as before.
This commit is contained in:
Marc-André Bombeck committed 2026-09-27 13:36:48 +02:00
1 parent 5e9c4fe8d8
commit 21a2e2fcef
14 files changed
+95 -21

No files matched your search

@@ -205,11 +205,18 @@ describe("a reuse chip", () => {
"result",
).map((f) => f.result);
expect(result.rows).toEqual(world.storedTables[0].rows);
expect(result.chart).toBeNull();
// The table shows first; the chart stays, so the chart is offered back.
expect(result.view).toBe("table");
expect(result.chart).toEqual(world.storedTables[0].chart);
expect(result.reusedFrom).toEqual({
messageId: h.LAST_ASSISTANT_ID,
ref: "r1",
});
const [chips] = framesOf<{ followUps: CoachFollowUp[] }>(
run.frames,
"followUps",
);
expect(chips.followUps.map((c) => c.kind)).toEqual(["as_chart"]);
expect(m.appendMessage).toHaveBeenCalledWith(
expect.objectContaining({ role: "assistant", providerType: "reuse" }),
);