Skip to content

Commit

Permalink
fix: export-notes command should wait until networkidle
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Oct 12, 2024
1 parent 3d1f722 commit 17f6e6b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/slidev/node/commands/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export interface ExportNotesOptions {
output?: string
timeout?: number
wait?: number
waitUntil?: 'networkidle' | 'load' | 'domcontentloaded'
}

function createSlidevProgress(indeterminate = false) {
Expand Down Expand Up @@ -124,7 +123,6 @@ export async function exportNotes({
output = 'notes',
timeout = 30000,
wait = 0,
waitUntil,
}: ExportNotesOptions): Promise<string> {
const { chromium } = await importPlaywright()
const browser = await chromium.launch()
Expand All @@ -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)
Expand Down

0 comments on commit 17f6e6b

Please sign in to comment.