Skip to content

Restore reading-position tracking for virtualized ChunkedMarkdown previews #264

Open

Description

@orbitingflea

Why

Upstream #40631 moved rendered workspace Markdown previews into a virtualized LegendList (apps/web/src/components/files/ChunkedMarkdown.tsx). During the 2026-11-23 upstream catch-up, preserving the fork's reading-position tracker via DOM scrolling across unmounted chunks (byText in fileReadingPlace.ts) hit the 3-round review cap with remaining streaming and jitter bugs.

Per standing catch-up conflict policy, the ChunkedMarkdown reading-position binding was dropped from t3-catchup-20261123 so main stays on upstream's ChunkedMarkdown and unfreezes cleanly.

Goal

Rebuild reading-position save and restore for ChunkedMarkdown previews cleanly on main without DOM probing:

  • Expose ChunkedMarkdown's in-memory { chunks, loading } via a minimal (~3-line) fork hook on apps/web/src/components/files/ChunkedMarkdown.tsx.
  • Resolve saved positions (including blocks shifted across chunk boundaries after earlier edits) synchronously in memory, gating restore completion on loading === false so >1 MB preview-to-full loads never lock onto a wrong chunk.
  • Restore full browser test coverage in fileReadingPosition.browser.test.tsx.

Activity

  1. orbitingflea commented on Nov 23, 2026

    @orbitingflea
    OwnerAuthor

    Also tracked here (same upstream pingdotgg#40631 progressive-loading change, deferred from the 2026-11-23 catch-up PR to keep fileReadingPlace.ts and fileReadingPosition.ts untouched from fork main):

    • For large text files (1–64 MB) that stream progressively in source view via LargeFilePreview / useFullFileText:
      1. Saved-line restore past the initial 1 MB preview should re-apply as text arrives until the reader scrolls or edits.
      2. Line-link reveals targeting a line past the 1 MB preview should wait for the download to finish before marking the reveal handled/shown (or clamping to EOF once complete), wired cleanly through the download-completion state rather than guessing from text length inside ReadingTracker.
  2. orbitingflea commented on Nov 23, 2026

    @orbitingflea
    OwnerAuthor

    This issue should also cover text files from 1 MB to 64 MB in the source view.

    Upstream pingdotgg#40631 now opens these files in parts. It shows the first megabyte at once, then loads the rest as it downloads. That causes two limits past the first megabyte:

    • A saved reading place is not restored if the rest of the file arrives after about one second.
    • A link to a line stops at the end of the text loaded so far, and the fork already counts that link as shown.

    The fix should track when the download finishes and whether upstream's line reveal already ran.

  3. added a commit that references this issue on Nov 23, 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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions