Skip to content

Commit

Permalink
Wait for next HTML rendering frame
Browse files Browse the repository at this point in the history
In parallel rendering, it may be needed to wait for the first rendering.
  • Loading branch information
yhatt committed Jan 15, 2025
1 parent a553d84 commit 8ec258a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,13 @@ export class Converter {
await page.goto('data:text/html,', waitForOptions)
await page.setContent(baseFile.buffer!.toString(), waitForOptions)
}

// Wait for next frame (In parallel rendering, it may be needed to wait for the first rendering)
await page.evaluate(async () => {
await new Promise<void>((resolve) =>
window.requestAnimationFrame(() => resolve())
)

Check warning on line 676 in src/converter.ts

View check run for this annotation

Codecov / codecov/patch

src/converter.ts#L674-L676

Added lines #L674 - L676 were not covered by tests
})
}

try {
Expand Down

0 comments on commit 8ec258a

Please sign in to comment.