Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for XHR to complete #6

Open
sevfurneaux opened this issue Aug 11, 2020 · 2 comments
Open

Wait for XHR to complete #6

sevfurneaux opened this issue Aug 11, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sevfurneaux
Copy link

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
Copy link
Owner

lucamug commented Aug 23, 2020

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

Screen Shot 2020-08-23 at 11 26 08

Other info at puppeteer/puppeteer#1552

@lucamug
Copy link
Owner

lucamug commented Aug 23, 2020

I should probably add this as parameter as different website could have different preference

@lucamug lucamug self-assigned this Aug 23, 2020
@lucamug lucamug added the enhancement New feature or request label Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants