Skip to content

Commit

Permalink
fix: Static service wait for network idle (#270)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Robdel12 authored Jul 2, 2019
1 parent 76c68fd commit 7d438d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/static-snapshot-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class StaticSnapshotService {
for (const url of pageUrls) {
logger.debug(`visiting ${url}`)

await page.goto(url)
await page.goto(url, { waitUntil: 'networkidle0' })

await page.addScriptTag({
path: percyAgentClientFilename,
Expand Down

0 comments on commit 7d438d2

Please sign in to comment.