Skip to content

Commit 7d438d2

Browse files
authored
fix: Static service wait for network idle (#270)
I've been seeing a lot of errors like: ``` Error: Execution context was destroyed, most likely because of a navigation. ``` This happens because we try to start altering the page (by injecting our JS) before everything is settled down. This change won't promise the page has actually loaded (that's very hard to determine) but it will wait for most network requests to resolve before trying do anything.
1 parent 76c68fd commit 7d438d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/services/static-snapshot-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default class StaticSnapshotService {
4949
for (const url of pageUrls) {
5050
logger.debug(`visiting ${url}`)
5151

52-
await page.goto(url)
52+
await page.goto(url, { waitUntil: 'networkidle0' })
5353

5454
await page.addScriptTag({
5555
path: percyAgentClientFilename,

0 commit comments

Comments
 (0)