Skip to content

Commit

Permalink
fix: export-notes command should wait until networkidle (#1898)
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX authored Oct 12, 2024
1 parent 3d1f722 commit bd90988
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 bd90988

Please sign in to comment.