Repository navigation
Release the served page's markup once a revision replaces it - #2574
Merged
Merged
Conversation
version.js kept the served baseline (its source copy, its source-to-live pairs and its head nodes) in module constants for the whole session. That copy routes each node back to the live node it came from, through its pairs and prepaint.js's `origins`, so every node the page was served with stayed in memory after a revision removed it: measured on a 1,200-node section, the Nodes count after GC stayed 2,450 higher for the rest of the session. The version controller now takes the baseline and the module drops its reference, so a revision's replacement releases it. Revision content was already released by the next revision; what the current baseline pairs stays in memory until a revision replaces it. New test: test_a_revision_releases_the_served_markup_it_removes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 12, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
…der's column (#2624) A reading place is now what stands at the landing edge, in the column the reader is using, rather than the first text block in document order plus a pixel offset from that block's start. That offset held only while nothing between the block's start and what the reader saw changed height, so a width change or a revision moved the reader whenever it did. A review of #2562 and #2574 as they sit together on main found the cases below; each became a test that fails on main. What a place stands on, in order: - a drawing the edge cuts (an `img`, `svg`, `canvas`, `video`, `picture`, `iframe`, `object`, `embed`, or a custom element holding no text block), or a box that scrolls on its own and is no reading region of its own, kept as how far through its height the edge cuts it. The browser's hit test names it, at the reader's column or the middle of the content. The line below it is recorded too, and stands in when a revision replaces the drawing's node. - otherwise the first line at or below the edge, quoted from its first character with the prefix and suffix a comment's anchor takes (`anchorForPassage`, split out of `anchorForRange`), measured from that line. Lines above it in the same paragraph can rewrap or be rewritten without moving what the reader sees. Text in a stuck sticky box, and runs under 24 characters (a nav of labels), name no place. - the reader's column (the pointer's last x over the box, else focus's) only decides between blocks standing side by side at that line's row. - a raw scroll offset is restored only in the same scroller, at the same width, in the same revision; elsewhere the browser's anchoring keeps the box. Memory: a place holds its focused node and body through WeakRefs, and `retainUserIntent` holds its source weakly, so a revision that removes the section the reader focused or clicked in frees it (#2574's guarantee, which #2562's `places` broke). Holds are keyed by scroller id with a WeakRef to the box; `writing` is a WeakMap. Also fixed: every bounded region's hold was dropped the first time it was read, because the hold compared region records with `===` and `readingRegions()` builds fresh records each call, so since #2562 a pane did not re-apply its restored place while its layout settled. Behavior changes (main → this, 1440×900 unless stated): - a paragraph partly under the banner, reader's line: 1200→600 +84px → +2.1px; 600→1200 −79px (under the banner) → +2.95px; a revision rewriting words above the line +84px → +2.1px. - a 2160px figure, reader 40% through: 1200→600 the figure's top landed 451px below the edge → stays 40% through at every width; a same-width revision inserting paragraphs above it threw the reader ~2000px back → −864 → −864.5. - a figure with its caption lower on screen: 22%/54% → 40% both ways. - two columns stacking at 800, reading the right one: 1255px → 4.45px. - a nav of short items stacking above the text, keyboard reader: 40px drift → line kept. - the shipped `layout-column` sticky sidebar: main threw the reader 2353px → paragraph kept. - a scrolling div that is no reading region: 47% → 60%/34% → 47.5% both ways. - a bounded pane whose content grows two frames after a resize: +200px → held. Known limits, shared with main: with scroll anchoring off (Safari), an image that loads late after a revision still moves the reader (21% → 22%), because a revision's restore is applied once rather than held; holding it would reverse the rule that a revision ends every hold. focus.js `stood`/`published` keep a removed focused node until the next input, and history.js keeps a clicked `#` link's focus for its entry's life. Tests: `test_a_width_change_keeps_what_stands_at_the_landing_edge` (new, nine shapes), `test_a_bounded_box_holds_its_place_while_its_layout_settles` (new); `inside` and `figure` cases on `test_live_revision_keeps_the_visible_semantic_reading`; `test_paging_down_from_a_landed_section_keeps_the_paged_passage` measures the word at the edge; `test_a_revision_releases_the_served_markup_it_removes` focuses a link in the removed section. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
version.js kept the served baseline (its source copy, its source-to-live
pairs and its head nodes) in module constants for the whole session. That
copy routes each node back to the live node it came from, through its pairs
and prepaint.js's
origins, so every node the page was served with stayedin memory after a revision removed it: measured on a 1,200-node section,
the Nodes count after GC stayed 2,450 higher for the rest of the session.
The version controller now takes the baseline and the module drops its
reference, so a revision's replacement releases it.
Revision content was already released by the next revision; what the
current baseline pairs stays in memory until a revision replaces it.
New test: test_a_revision_releases_the_served_markup_it_removes.