Skip to content

End a sample's asked hold once the reader looks away from its frame - #6808

Merged
max-sixty merged 1 commit into
mainfrom
live-sample-height
Nov 23, 2026
Merged

max-sixty merged 1 commit into
mainfrom
live-sample-height

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A live sample the reader sees as it starts holds what showed it until its frame fits the sample's page: the containing page's presentation, for a frame seen as it mounts, or the landing of the jump that brought it into view. In Chromium a sample's page gets no rendering while its frame is off screen, so a child holding a chart never upgrades there, and a reader who scrolled past the frame while it loaded held the page until they scrolled back. On main, a page whose first screen held a chart sample never presented (readiness stuck at "upgraded" 23 s after the child loaded), so its keys stayed dead; one reached by a jump kept an arrival outstanding and its rendering unsettled.

The hold now also ends once the frame's growth would move nothing the reader sees (whenNone over growthIsSeen); the host keeps counting the child's arrival by its own rules (sample.js, #6783).

To weigh:

  • whenNone, which heldGrowth already uses inside the runtime, joins the package API, documented beside heldGrowth. heldGrowth can't end this hold, since before the page presents it applies at once.
  • A frame clipped sideways, as by a horizontal scroller, still counts as seen (growthIsSeen reads only the vertical band), so its hold still waits in Chromium, as on main.
  • A reader who jumps to a sample, away and back before its page loads no longer has the second jump own the fit (the shift watch would report the fit as moving without input; the pixels move as on main). A version that re-decided ownership on return needed a watch per near-reading, Reset and disconnect, and Codex found four defects in it, so it isn't here.

Found by Codex reviewing #6783, as an existing defect; Codex reviewed this fix in two rounds.

Tests: a new journey test holds both children's registries while it checks that the page presents and settles; it fails on main (no presentation within 120 s) and passes in Chromium and Firefox. The sample hosting, shift-watch jump and live-sample tests, pnpm run test:runtime and pnpm run check:browser pass.

This was written by Claude Code on behalf of max-sixty

A live sample the reader sees as it starts holds what showed it until the
frame fits its page: the containing page's presentation, for a frame seen
as it mounts, or the landing of the jump that brought it into view, which
the page counts as an arrival and a rendering hold. In Chromium a sample's
page gets no rendering while its frame is off screen, so a child holding a
chart never upgrades there, and a reader who scrolled past the frame while
it loaded held the page until they scrolled back. Measured on main, 23 s
after the child's registry loaded: a page whose first screen held a chart
sample never presented (readiness stuck at "upgraded"), and one reached by
a jump kept an arrival outstanding and its rendering unsettled.

The hold now also ends once the frame's growth would move nothing the
reader sees (`whenNone` over `growthIsSeen`); the host keeps counting the
child's arrival by its own rules (sample.js). `whenNone` is exported from
widget-api.js and documented beside `heldGrowth`, which can't end this
hold since it applies at once before the page presents.

Two cases stay as they were or change slightly:
- A frame clipped sideways, as by a horizontal scroller, still counts as
  seen (`growthIsSeen` reads only the vertical band), so its hold still
  waits in Chromium, as on main.
- A reader who jumps to a sample, away and back before its page loads no
  longer has the second jump own the fit; re-deciding ownership on return
  needed a watch per near-reading, Reset and disconnect, and a review
  found four defects in that version.

The new journey test keeps both children's registries held while it
checks that the page presents and settles; it fails on main (no
presentation within 120 s) and passes in Chromium and Firefox.
@max-sixty
max-sixty merged commit 089c3dd into main Nov 23, 2026
6 checks passed
@max-sixty
max-sixty deleted the live-sample-height branch November 23, 2026 03:05
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.

2 participants