Skip rendering work for off-screen OpenAPI blocks - #4502
Open
nolannbiron wants to merge 2 commits into
Open
Conversation
nolannbiron
had a problem deploying
to
2v-preview
August 14, 2026 15:48 — with
GitHub Actions
Failure
🦋 Changeset detectedLatest commit: dea0146 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Contributor
Style invalidation on a large API referenceElements restyled by opening one popup on the Snyk API reference. A share near or above 100% means the insertion restyles the whole document.
|
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.
A customer page with 95 OpenAPI blocks —
oeconnection.gitbook.io/partstech-partner-api/api-reference/v3— is effectively unscrollable. Measured from its shipped HTML: 95 operation blocks, ~45,700 DOM elements, 6.4 MB of markup (8.2 MB with the RSC payload), and 95position: stickypreview panes. Every operation is styled, laid out and painted on every frame, whether or not it is anywhere near the viewport. This is not specific to computed pages — it happens on any hand-authored page that drops manyopenapi-*blocks into a document, which is what this customer did.content-visibility: autoon.openapi-blocklets the browser skip that work for blocks that are off screen. The DOM is untouched, so the server HTML, find-in-page,#anchorsand the outline all keep working — which is why this is CSS rather than unmounting nodes: SEO is the whole point of these pages.contain-intrinsic-height: auto 1200pxgives a skipped block its placeholder height. Theautokeyword makes the browser remember each block's real height once rendered, so the estimate only ever applies to blocks never scrolled to; the plain-length declaration before it is a fallback for engines withoutautosizing, where a skipped block would collapse to 0. 1200px is a reasoned guess, not a measurement — worth tuning on the preview with:PDF export lays the whole space out off screen, so
body:has(.print-mode)and@media printopt out.Not covered by this PR: hydration cost is unchanged — every block is a client component rendered with
next/dynamic({ ssr: true }), so React still builds ~45k fibers on load. If scrolling is still rough on the preview, deferring hydration of off-screen blocks is the next lever. Payload size is also unchanged.