Repository navigation
feat: add useLayoutSnapshot - #1677
Closed
domgan-oai wants to merge 5 commits into
Closed
domgan-oai wants to merge 5 commits into
domgan-oai wants to merge 5 commits into
Conversation
domgan-oai
marked this pull request as ready for review
October 3, 2026 17:51
Contributor
Benchmark report🟢 No budget breaches, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
50 other measured values are unchanged. Public-import reachability bundles (bytes)
104 other measured values are unchanged. |
This was referenced Oct 3, 2026
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.
Summary
Add
useLayoutSnapshotfor values that need to be measured from committed DOM and reflected in rendered output before paint. A stable initial value is used for server rendering and hydration; measurements publish only when they change.Validation
pnpm format:check(repository-wide check not run; changed files passed the scoped formatter)pnpm typecheck(the full workspace command was blocked before typechecking by registry HTTP 403 responses for unrelated dependencies; Octane core and public API typechecks passed)pnpm test(full suite not run)pnpm sync, changeset and release-plan checks.Risk / follow-ups
Provenance
agent-authored)Codex task:
01a0d872-201b-7472-bbe9-adcca6ba2406· host:com-79386Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
New layout-time state publication path with suspense/async interaction and update-depth limits; DOM-only support means misuse on universal/Valdi is a compile-time rejection but wrong renderer choice could surprise adopters.
Overview
Ships
useLayoutSnapshotas a public Octane hook for rendering from committed DOM measurements before paint, withinitialfor SSR/hydration and optionalequal(defaultObject.is) so only changed snapshots schedule updates.The DOM client runtime runs the measure callback in a layout effect, publishes updates with sync-flush semantics (including convergence guarding), and the server returns
initialwithout measuring. The compiler registers the hook for slots, spread-args, passive setup, renderer boundaries (DOM only), and Strong mode treats the measure/equalcallbacks like layout-effect work (no state writes, no leaked resources) while snapshot return values are not mistaken for effect cleanup.Docs and site promote the API alongside
createResizeObserver; tests cover hydration, Suspense/Activity, plain TS spreads, Chromium first-frame timing, and SSR shell witnessing.Reviewed by Cursor Bugbot for commit 3c25981. Bugbot is set up for automated code reviews on this repo. Configure here.