Skip to content

Draw the unread line on load - #90

Merged
david-sling merged 1 commit into
mainfrom
unread-line
Sep 28, 2026
Merged

david-sling merged 1 commit into
mainfrom
unread-line

Conversation

@david-sling

Copy link
Copy Markdown
Owner

The "New messages below" divider never appeared. In the commit where ready turned true, the page scrolled to the end and stored the head as read, and the marker, deferred to a microtask, then read back that head. So every visit looked caught up.

  • use-read-marker.ts: the stored mark is captured on mount, in an effect declared ahead of everything that advances it. The line is drawn from that capture once the transcript is ready. It is still read after mount, never during render, and still frozen for the visit.
  • transcript.tsx: with the line working, a first visit (nothing stored, so mark 0) drew it above the first item. A line with nothing read above it marks nothing, so unreadLineBefore doesn't draw it there.

Testing

  • unreadLineBefore and the rendered position of the line are unit-tested in app/components/transcript.test.tsx.
  • The effect ordering can't be reached from the node test environment, so it was checked on the dev server:
    • a mark of 2 of 4 draws the line before seq 3;
    • no stored mark draws none;
    • a mark of 4, with messages 5 to 8 arriving mid-visit, keeps the line before seq 5.
  • npm test, tsc and lint are clean.

🤖 Generated with Claude Code

The line never appeared. In the commit where ready turned true, the
effect that follows the end scrolled to the bottom and the one that notes
the scroll position stored the head as read, and the marker, deferred to a
microtask, then read back that head. So it was always caught up.

The stored mark is now captured on mount, in an effect declared ahead of
everything that advances it, and the line is drawn from that capture once
the transcript is ready. It is still read after mount, never during
render, so the server and client renders still agree, and it is still
frozen for the visit.

Fixing that surfaced a line on every first visit: with nothing stored the
mark is 0, and the divider went above the first item. A line with nothing
read above it marks nothing, so it is not drawn there. That rule is pure,
in unreadLineBefore, and tested; the effect ordering is not reachable from
the node test environment and was checked on the dev server: mark 2 of 4
draws the line before seq 3, no mark draws none, and a message arriving
mid-visit leaves the line where it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wave Ready Ready Preview Sep 28, 2026 7:53pm UTC

@david-sling
david-sling merged commit 506294e into main Sep 28, 2026
6 checks passed
@david-sling
david-sling deleted the unread-line branch September 28, 2026 19:54

This branch was successfully deployed

1 active deployment
Preview — 891a5dc7 Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant