Skip to content

Commit cc50fc4

Browse files
committed
Always use page.waitForNetworkIdle() to wait initial rendering
1 parent 036735a commit cc50fc4

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/converter.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -726,22 +726,17 @@ export class Converter {
726726
this.trackFailedLocalFileAccess(page)
727727

728728
const render = async () => {
729+
const waitUntil = 'domcontentloaded' as const
730+
729731
if (uri) {
730-
await page.goto(uri, {
731-
waitUntil: ['domcontentloaded', 'networkidle0'],
732-
})
732+
await page.goto(uri, { waitUntil })
733733
} else {
734-
await page.goto('data:text/html,', {
735-
waitUntil: ['domcontentloaded', 'networkidle0'],
736-
})
737-
738-
// https://github.com/marp-team/marp-cli/issues/682 -- Use page.waitForNetworkIdle() instead of `waitUntil: 'networkidle0'`
739-
await page.setContent(baseFile.buffer!.toString(), {
740-
waitUntil: 'domcontentloaded',
741-
})
742-
await page.waitForNetworkIdle()
734+
await page.goto('data:text/html,', { waitUntil })
735+
await page.setContent(baseFile.buffer!.toString(), { waitUntil })
743736
}
744737

738+
await page.waitForNetworkIdle()
739+
745740
// Wait for next frame (In parallel rendering, it may be needed to wait for the first rendering)
746741
await page.evaluate(async () => {
747742
/* c8 ignore start */

0 commit comments

Comments
 (0)