Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

fix(puppeteer): Wait until networkidle2 for better dev server support #63

Merged
merged 2 commits into from
Oct 1, 2018
Merged

fix(puppeteer): Wait until networkidle2 for better dev server support #63

merged 2 commits into from
Oct 1, 2018

Conversation

toolmantim
Copy link
Contributor

@toolmantim toolmantim commented Oct 1, 2018

Switches to networkidle2 during Puppeteer navigation, preventing timeouts when requesting pages that are served from webpack-dev-server and similar tools (which can keep open event-source sockets for HMR, etc).

The networkidle2 event is fired when there are no more than 2 network connections for at least 500 ms. If the page you're requesting is expected to have less than 2 resources that stall for longer than 500ms you can switch back to networkidle0 using the new --puppeteer-wait-until option.

Fixes #62

Switches to networkidle2 during Puppeteer navigation, preventing
timeouts when requesting pages that are served from webpack-dev-server
(which holds open event-source sockets for HMR).

The networkidle2 event is fired when there are no more than 2 network
connections for at least 500 ms. If the page you're requesting has less
than 2 resources that stall for longer than 500ms, and doesn't complete
loading you can switch back to networkidle0 using the new
`--puppeteer-wait-until` option.

Fixes #62
@toolmantim toolmantim changed the title Wait until networkidle2 for better dev-server support fix(puppeteer): Wait until networkidle2 for better dev-server support Oct 1, 2018
Copy link
Member

@markdalgleish markdalgleish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one—this looks great 👏👏👏

@toolmantim
Copy link
Contributor Author

🤦🏼‍♂️ Oh dear, I see that I completely forgot about the docs! Thanks for the addition @markdalgleish 🙏🏼

@markdalgleish markdalgleish merged commit 17f9663 into seek-oss:master Oct 1, 2018
@markdalgleish markdalgleish changed the title fix(puppeteer): Wait until networkidle2 for better dev-server support fix(puppeteer): Wait until networkidle2 for better dev server support Oct 1, 2018
@toolmantim
Copy link
Contributor Author

🎉

@markdalgleish
Copy link
Member

Available now in v0.6.2. Thanks so much for the PR! 🙌

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants