Skip to content

[Bug]: Saved notebook output can stay blank after scrolling it into view #40996

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a notebook with one cell containing 17 short saved HTML outputs in the Files panel.
  2. Make the notebook preview about 940 pixels tall.
  3. Scroll to the bottom of the cell.

Expected behavior

The final output displays its saved content.

Actual behavior

The final output is a blank block even though it is fully in view.

last saved output

failure

Impact

Minor bug or occasional failure. Readers can miss saved content when many compact HTML outputs fit in or just outside a tall notebook preview.

Version or commit

main at 6972026121. The cause is at apps/web/src/components/files/NotebookPreview.tsx:60.

Environment

Linux x64 boat.dev default machine, a fresh checkout.

Logs or stack traces

Output is in view but blank
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/scripts/scenarios/notebook-shows-visible-saved-output.e2e.ts b/scripts/scenarios/notebook-shows-visible-saved-output.e2e.ts
new file mode 100644
index 0000000000..2897ecc0df
--- /dev/null
+++ b/scripts/scenarios/notebook-shows-visible-saved-output.e2e.ts
@@ -0,0 +1,77 @@
+/// <reference lib="dom" />
+import { expect } from "e2e";
+
+import { test, WEB } from "./t3.ts";
+
+const notebook = {
+  nbformat: 4,
+  nbformat_minor: 5,
+  metadata: { language_info: { name: "python" } },
+  cells: [
+    {
+      id: "results",
+      cell_type: "code",
+      source: [],
+      metadata: {},
+      execution_count: 1,
+      outputs: Array.from({ length: 17 }, (_, index) => ({
+        output_type: "display_data",
+        metadata: {},
+        data: { "text/html": `<span>Saved result ${index + 1}</span>` },
+      })),
+    },
+  ],
+};
+const fifteenthOutputFrame = '[data-notebook-output="0-14"] iframe';
+const lastOutput = '[data-notebook-output="0-16"]';
+
+test(
+  "A visible saved notebook output renders when earlier outputs have scrolled above it",
+  WEB,
+  async ({ t3, app, screen, browser }) => {
+    const project = await t3.project("demo", { "results.ipynb": JSON.stringify(notebook) });
+    const thread = await t3.thread({ project, title: "Review results", messages: ["Start"] });
+    await browser.setViewport({ width: 1440, height: 1080 });
+    await t3.open(thread);
+    await screen.getByText("fixture turn complete", { exact: false }).waitFor();
+
+    await browser.keyboard.press("Control+p");
+    await screen.getByPlaceholder("Search files…").fill("results.ipynb");
+    await screen.getByRole("option", "results.ipynb", { exact: false }).tap();
+    await browser.locator(lastOutput).waitFor({ state: "attached", timeout: 120_000 });
+
+    // Leave room for the final output and fewer than sixteen preceding outputs.
+    const height = await browser.evaluate((selector) => {
+      const viewport = document.querySelector(selector)!.closest(".scrollbar-gutter-both")!;
+      return window.innerHeight - viewport.clientHeight + 940;
+    }, lastOutput);
+    await browser.setViewport({ width: 1440, height });
+    await browser.locator(fifteenthOutputFrame).waitFor({ timeout: 30_000 });
+    await browser.evaluate((selector) => {
+      const viewport = document.querySelector(selector)!.closest(".scrollbar-gutter-both")!;
+      viewport.scrollTop = 170;
+      return null;
+    }, lastOutput);
+
+    try {
+      await expect
+        .poll(() =>
+          browser.evaluate((selector) => {
+            const output = document.querySelector(selector);
+            const viewport = output?.closest(".scrollbar-gutter-both");
+            if (!output || !viewport) return null;
+            const bounds = viewport.getBoundingClientRect();
+            const row = output.getBoundingClientRect();
+            if (row.top < bounds.top || row.bottom > bounds.bottom) return null;
+            return (
+              output.querySelector("iframe")?.contentDocument?.body?.textContent?.trim() ||
+              "Output is in view but blank"
+            );
+          }, lastOutput),
+        )
+        .toBe("Saved result 17");
+    } finally {
+      await app.screenshot("last-saved-output");
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/notebook-shows-visible-saved-output.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions