Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): a stalled first-screen request no longer blocks large file previews #48137

MergedStiensWout(GitHub profile, opens in a new tab)merged 5 commits intomain fromrefs/pull/48137/headmerged by juliusmarminge View on GitHub

Large text and CSV previews fetch a 16 KB first screen before starting the worker that loads the full file. If that response stalled after its headers arrived, the worker never started and the preview stayed on "Loading file". The worker now starts once the first screen settles or after one second, and a stalled first-screen request is aborted at that point so it does not keep a browser connection busy.

Related: #25149, #45854

Reproduction on main

Commit cc19795ea7 (main). The preview stays on Loading file. It never requests the full file. Expected: The table and row count appear from the full-file request even if the first-screen response stalls.

  1. Set up a connection that stalls the body of the first 16 KB range response while allowing full-file requests through.
  2. Open a CSV larger than 1 MB in the workspace Files panel.

The cause is at apps/web/src/components/files/LargeTextViewer.tsx:239. Ran pnpm scenarios:prove scripts/scenarios/large-csv-loads-when-its-prefix-stalls.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, with expect.toBeVisible failed in the output.

Evidence

Environment: Linux x64 on a boat.dev VM reset before each run, the repository's own tests.

Proven: the replacement test apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx fails at the test commit b07504c819 and passes on the head 4237f04f2c, both on main 3eb5894919.

BeforeAfter
Commitb07504c8194237f04f2c
Resultfailed with "to contain '5,000 rows · 2 columns'"passed
csv with a stalled prefixBefore: csv with a stalled prefix Before: csv with a stalled prefix (changed region)
The preview stays on Loading file. It never requests the full file.
After: csv with a stalled prefix After: csv with a stalled prefix (changed region)
The table and row count appear from the full-file request even if the first-screen response stalls.
failureBefore: failure
RecordingBefore: recordingAfter: recording

Tests

  • b07504c819 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed 3eb58949194ce010be0af51d861d3292127e8a37 passed on head.

Not in this change

  • Mobile reads file previews through a single bounded request with no separate full-file worker, so it has no matching wait.

Who did the work

  • Repro written by GPT 6.2 Sol, in Codex
  • Duplicate check judged by Claude Opus 5.5, in Claude Code
  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by Claude Opus 5.5 and GPT 6.2 Sol

    1. Pushed617b25e

    2. Evidence

      Scenario: A stalled first-screen response gives large CSV previews to the full-file worker

      Steps: seeded a 5,000-row CSV, opened its thread and file preview, stalled the initial 16 KiB Range response body in the browser, waited two seconds, and checked for the row-count summary. Scenario source

      Base 9a08ffb840Head 617b25edf8
      Result❌ Loading spinner remained; row-count assertion failed✅ Table rendered with 5,000 rows · 2 columns · 1.1 MB
      CaptureBase stalled previewHead recovered preview
    3. juliusmarminge added labelstakeover:ready

    4. juliusmarminge removed labelstakeover:in-progress

    5. juliusmarminge merged thisd54e1eb

    6. juliusmarminge closed this

    7. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.