From bd90988a04f0a046b03ff445f866dde93d174c77 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Sat, 12 Oct 2024 22:26:34 +0800 Subject: [PATCH] fix: `export-notes` command should wait until `networkidle` (#1898) --- packages/slidev/node/commands/export.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/slidev/node/commands/export.ts b/packages/slidev/node/commands/export.ts index 39df23140d..a2b08095d7 100644 --- a/packages/slidev/node/commands/export.ts +++ b/packages/slidev/node/commands/export.ts @@ -79,7 +79,6 @@ export interface ExportNotesOptions { output?: string timeout?: number wait?: number - waitUntil?: 'networkidle' | 'load' | 'domcontentloaded' } function createSlidevProgress(indeterminate = false) { @@ -124,7 +123,6 @@ export async function exportNotes({ output = 'notes', timeout = 30000, wait = 0, - waitUntil, }: ExportNotesOptions): Promise { const { chromium } = await importPlaywright() const browser = await chromium.launch() @@ -138,9 +136,8 @@ export async function exportNotes({ if (!output.endsWith('.pdf')) output = `${output}.pdf` - await page.goto(`http://localhost:${port}${base}presenter/print`, { waitUntil, timeout }) - if (waitUntil) - await page.waitForLoadState(waitUntil) + await page.goto(`http://localhost:${port}${base}presenter/print`, { waitUntil: 'networkidle', timeout }) + await page.waitForLoadState('networkidle') await page.emulateMedia({ media: 'screen' }) if (wait)