Repository navigation
Render trace controls and saved evidence with retained Lit templates - #2346
Merged
Merged
Conversation
leaf-agent
approved these changes
Oct 11, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
…puts (#2514) Follow-up to #2346, from the review of the Lit survey PRs (item 36 in that review's numbering, not a GitHub issue). It finishes the Lit conversion of `lf-trace`, whose lifecycle already moved to `whileConnected`/`frameFor` in #2503. ## Review item 36: `lf-trace` reads its Lit nodes through refs - **Selector table removed.** After each render, a 22-entry table queried the Lit output and stored nodes as public element properties (`trace.play`, `trace.next`, `trace.body`, ...). The template now binds each node the widget reads to a private `createRef()`. No test, widget or tool outside the widget read those properties. Only the table read the six transport classes `lf-trace-first`, `-previous`, `-next`, `-zoom-in`, `-zoom-out` and `-zoom-fit`, so they are gone from the markup. - **`#viewState()` removed.** It built a bag of eleven values that `#paint()` then unpacked. `#paint` now reads scope, extent, choices, origin and moments itself. `#draw` passes only the selected point, its saved tree and the tree rows, which it also uses for projection. - **Other lookups after render.** The missing-image note, input badge and point, and playback image are private fields. One helper now builds the playback image, which `#placePlayback` used to build a second time. Each capture figure keeps its canvas, image and status nodes, so `#drawPicture` no longer queries the figure by class. Three `images.find` calls now use `#imageById`. A Moment that targets a saved element finds its row in the part inventory instead of through a `data-lf-datum` query. - **Hand-written labels.** The position, selection and image-zoom labels are still written directly. A comment on `#drawTime` now says why: they change on every playback frame or pinch step, and `#draw` re-renders and re-projects. - **Resize.** The window `resize` listener the review saw beside the ResizeObserver was already removed in #2429, so the observer is the only thing that calls `#resize`. Behaviour that changed: none visible to the user. | | hand-written source | tests | |---|---|---| | Item 36 (`lf-trace.js`) | −20 (+210 −230) | 0 | ## Validation - These cases in `tests/test_render_playwright_trace.py` pass: comments restoring an exact image, bookmarks, comparison pairing, transport and playback, inspection through playback gaps and scope changes (it includes the saved-tree place checks), zoom and pan, the hidden recording, capture replacement, frames keeping saved elements, the play press, images at their capture times, and idle presentation. - Prettier and eslint pass. > _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.
The trace widget renders its controls, moments and saved-tree rows through one synchronous Lit view. Keyed templates replace the manual tree and bookmark node caches. Vis Timeline pins, Viewer.js figures and image zoom retain their existing owners; saved-tree navigation restores the reading place even when rows are recreated.
Survey item 8, measured after integrating authored-Moment entry-point selection and canonical vendor imports:
lf-trace.jschanges from 1,947 to 1,958 lines (11 added), while its size falls from 76,651 to 75,171 bytes. The conversion removes competing DOM ownership and manual tree/bookmark caches rather than reducing the line count.Validation: independent code review and integration review; initial authored-Moment selection, exact bookmark and playback-gap/scope journeys passed. A paired browser probe retained a 369-pixel saved-tree reading place and the same native disclosure node through navigation; mouse selection, frame toggles and stepping passed. The refreshed startup probe loaded the same 248 code requests with 1,271 fewer code bytes, matching initial selection and no errors. A dark 390-pixel touch viewport had no horizontal overflow.