Wait for XHR to complete
sevfurneaux opened this issue · 2 comments
sevfurneaux commented
First of all – great project!
I wondered: would it be possible to "wait" for an XHR request to complete before the page is statically rendered?
For example, an Elm app on init
could make a Http.get
request and then perform an update
.
At the moment, the "Loading" state would be statically rendered, while the ideal situation would be it actually renders the requested data.
The more I think about this, the more complex it is 😅
lucamug commented
The html generation part is based on puppeteer
:
await page.goto(`${conf.startingDomain}${url}`, {waitUntil: 'networkidle0'});
From the documentation:
https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagegotourl-options
Other info at puppeteer/puppeteer#1552
lucamug commented
I should probably add this as parameter as different website could have different preference