Skip to content

Let a long document open in a window — today a 200-page Word file or note mounts every paragraph at once and the tab blocks for seconds #233

Open

Description

@bencode

Problem

The reading pane is the one large surface with no windowing. StandardMarkdownReader and the note reader hand the whole content string to react-markdown (ui-packages/web/src/components/markdown.tsx:8,115), which parses and mounts every block in a single synchronous render — no virtualization exists anywhere under features/reader/markdown-reader.

The ordinary route to a very large markdown string is a Word document: ui-packages/web/src/features/reader/docx-reader.tsx:87-89 converts the entire .docx to markdown and renders it through that reader. A ~1 MB .docx — far under every limit — expands to 1–3 MB of markdown; the 5 MB text cap (text-file-reader.tsx:50-53) checks only the stored blob's size, so it never applies to this path, and imports go up to 200 MB (core/files.ts:3).

Measured on this machine (react-markdown + remark-gfm, renderToStaticMarkup — parse and element creation only, before any DOM mount, layout, rehype-highlight or rehype-katex): 2,000 paragraphs = 215 ms; 8,000 paragraphs (1.34 MB) = 701 ms; 20,000 (3.37 MB) = 1,995 ms. In the browser the same document pays a multiple of that inside one React commit, during which the whole workspace is unresponsive, and it then keeps a DOM of hundreds of thousands of nodes for as long as it stays open.

Every other large surface got, or is getting, windowing: the sheet grid row-virtualizes (xlsx-reader/sheet-grid.tsx:1,77), the conversation transcript is #201, the Files panel is #166. PRODUCT.md wants reading to "feel immediate" and be "the largest and quietest part" of the workspace — but long documents are exactly the files ordinary readers bring (contracts, reports, ebooks), and the reading pane is the last unwindowed surface they open them in.

Proposal

Goal

After this, opening a 200-page Word document or a multi-megabyte note takes about as long as opening a one-page note, the tab stays responsive while it opens, and scrolling a long document does not slow as its length grows.

Verification

grep -rq "Virtualizer" ui-packages/web/src/features/reader/markdown-reader
pnpm --filter @gamma-reader/web exec vitest run --project unit --testNamePattern="window"
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 26, 2026
  2. bencode commented on Oct 26, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop (a session separate from the one that files these issues), under the maintainer's standing instruction to evaluate, sharpen, or retire source:scheduled proposals. Audited against main@70eb94e (PRs #231/#232/#234/#235 landed since last beat).

    Evidence audit: every citation confirmed; two drift notes.

    Sensor: lint ✓; verify ✗ — correctly reads "not implemented". The Virtualizer grep is the load-bearing discriminator and is the right shape (mirroring the grid means the repo's own @tanstack/react-virtual). Note: the --testNamePattern="window" line already passes vacuously today (two unrelated threshold-"window" tests match) — harmless as a regression floor, but the new tests should be pinned by name, not relied on through that pattern.

    Verdict: valid, keep open. No duplicate among open or closed issues (#201 transcript, #166 Files panel, #175 memory — the three siblings are separately scoped; #55 was the Labs precedent). This completes the windowing family the queue has been building.

    One sharpening suggestion: the Goal's "about as long as a one-page note" is the outcome to pin — an implementation that windows blocks but still parses the full string up front (remark runs before React) meets the Virtualizer grep while missing the Goal. Worth a test asserting parse work scales with the window, not the document (e.g. lazy remark per block, or a parse-time budget).

  3. bencode commented on Oct 30, 2026

    @bencode
    OwnerAuthor

    Independent re-review — posted by the scheduled issue-reviewer loop, independent of the authoring session. Audited against main@d05b6b6 (2026-10-28), two days of commits after the last review (main@70eb94e).

    Evidence re-audit: all anchors hold in substance; drift only.

    • components/markdown.tsx:8 exact; the whole-string <ReactMarkdown> mount now at :119-126 (cited :115, +4 lines). features/reader/markdown-reader/ — 17 files, still zero Virtualizer.
    • docx-reader.tsx:87-89 — still renders the entire converted string through StandardMarkdownReader ✓. text-file-reader.tsx:50-53 — the 5 MB cap still checks only document.size ✓. core/files.ts:3 — 200 MB import ceiling ✓.
    • Only two commits since the review touch any anchor file, both the precedent: 7f7ac7a + 4f2d801 moved useVirtualizer in xlsx-reader/sheet-grid.tsx from :92 (last review) to :94. markdown.tsx, docx-reader.tsx, and the caps are untouched.
    • 4016b2b (Word text box marked where it stood) changed conversion output, not the conversion route — the whole-document path this issue targets is unchanged.

    Sensor: lint ✓; verify ✗ on main for the right reason (the Virtualizer grep is the failing step).

    Duplicate re-scan (open + closed): none. #201 (transcript), #166 (Files panel), #175 (memory face) are the siblings on other surfaces; #275 is workbook parsing, not mounting.

    Verdict: valid — stays open. Prior sharpening stands unchanged: pin parse work scaling with the window (not the document length), or an implementation that windows blocks but runs remark over the full string up front still meets the grep while missing the Goal.

    --
    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

  4. bencode commented on Nov 8, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit @ d05b6b6 (still HEAD; zero commits since the 10-30 pass) — valid, stays open. What changed since that pass is the queue, not the code: #292/#294/#295 (filed 10-30 → 11-05) are all unrelated (cross-tab key propagation, project export, preset keys) — duplicate re-scan over open + closed stays clean; #201/#166/#275 remain separately scoped siblings.

    • Evidence re-opened, holds in substance; the only drift is the known one: the whole-string mount in components/markdown.tsx sits at :119-126 (Refs cite :115; the :8 import is exact), docx-reader.tsx:87-89, text-file-reader.tsx:50-53, core/files.ts:3 (200 MB ceiling) all exact, the sheet-grid precedent's useVirtualizer call at :94, and still zero Virtualizer anywhere under features/reader/markdown-reader.
    • Sensor re-run: lint ✓; verify ✗ for the right reason — the Virtualizer grep is the failing step.
    • Sharpening stands from the first review: pin parse work scaling with the window, not the document (remark over the full string up front would pass the grep while missing the Goal), and the --testNamePattern="window" line already passes vacuously via two unrelated threshold tests — the new tests should be pinned by name.

    No edits; stays open.

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

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions