Skip to content

fix(screenshot): require full hydrate before skipping prepare scroll - #880

Merged
Kikobeats merged 1 commit into
masterfrom
cursor/critical-bug-management-7c60
Aug 23, 2026
Merged

Kikobeats merged 1 commit into
masterfrom
cursor/critical-bug-management-7c60

Conversation

@cursor

@cursor cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

After #869, a budgeted readiness hydrate on a still-white overflow SPA could mark itself complete after scrolling only one viewport. prepareFullDocument then skipped the long scroll and shipped incomplete fullPage screenshots/PDFs as success for pages that load content lazily on scroll.

Root cause

scrollFullPageToLoadContent set hydrated when hasOverflow && scrolledPx >= viewport, not when the document end was reached. Screenshot/PDF readiness paths pass that flag as scrolled: true into prepareFullDocument.

Fix

Treat a hydrate as complete only when scrolledPx + viewport >= pageHeight (and overflow is present). Partial hydrates still help paint readiness, but prepare runs the full scroll afterward.

Validation

  • Added unit coverage for isCompleteScroll and prepare skip/no-skip based on complete vs partial hydrate.
  • pnpm exec ava test/prepare-full-document.js test/white-retry.js in packages/screenshot — 10 tests passed.
Open in Web View Automation 

Note

Medium Risk
Tightens screenshot/PDF full-page scroll completeness, which can change capture timing and output for overflow pages. Logic is localized and covered by unit tests.

Overview
Fixes incomplete fullPage captures on lazy-scroll SPAs. A budgeted hydrate could previously mark itself done after one viewport, so prepareFullDocument skipped the long scroll and returned truncated screenshots/PDFs as success.

hydrated is now true only when overflow exists and scrolledPx + viewport reaches pageHeight. Partial hydrates still help paint readiness, but prepare always runs the full scroll afterward. Adds unit coverage for complete vs partial hydrate skip behavior.

Reviewed by Cursor Bugbot for commit a058f6a. Bugbot is set up for automated code reviews on this repo. Configure here.

A budgeted readiness hydrate marked itself complete after one viewport,
so prepareFullDocument skipped the long scroll and shipped incomplete
fullPage screenshots/PDFs for overflow SPAs that only paint after scroll.

Co-authored-by: kikohumanbeatbox <kikohumanbeatbox@gmail.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage is 80.781%cursor/critical-bug-management-7c60 into master. No base build found for master.

@Kikobeats
Kikobeats marked this pull request as ready for review August 23, 2026 08:00
@Kikobeats
Kikobeats merged commit 9b2d68a into master Aug 23, 2026
22 checks passed
@Kikobeats
Kikobeats deleted the cursor/critical-bug-management-7c60 branch August 23, 2026 08:01
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.

3 participants