Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -647,4 +647,11 @@ describe("OpenGenUIActivityRenderer", () => {
});
expect(parsed.success).toBe(true);
});

it.each([[-100, "50px"], [0, "50px"], [50000, "4000px"], [300.2, "301px"], [NaN, "200px"], [Infinity, "200px"]])("bounds invalid initial activity height %s", async (initialHeight, expected) => {
const { container } = renderRenderer({ initialHeight, generating: true });
await flushImport();
expect(container.querySelector<HTMLElement>("div[style]")!.style.height).toBe(expected);
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function styleIframe(iframe: HTMLIFrameElement) {

const OpenGenUIActivityRendererInner = React.memo(
function OpenGenUIActivityRendererInner({ content }: InnerProps) {
const initialHeight = content.initialHeight ?? 200;
const initialHeight = clampReportedHeight(content.initialHeight) ?? 200;
const [autoHeight, setAutoHeight] = useState<number | null>(null);
const sandboxFunctions = useSandboxFunctions();

Expand Down