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

Add prefetch for linked component modules to page HTML #14262

Closed
Moocar opened this issue May 23, 2019 · 3 comments
Closed

Add prefetch for linked component modules to page HTML #14262

Moocar opened this issue May 23, 2019 · 3 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more.

Comments

@Moocar
Copy link
Contributor

Moocar commented May 23, 2019

Background

The new per-page-manifest feature replaces the global pages-manifest with a page-data.json for each page. The pages-manifest meant that the browser had all the component and dataPath information it needed, and could therefore prefetch component and query results in parallel. Since we no longer have the global list of all page metadata, we now have to first request the page-data.json for the page, retrieve the component name, and then request the component. So we now have to wait for 2 prefetch requests to execute serially before we have all the information required to quickly navigate to a page. This performance impact will only be felt by users on slow connections, but it's still a regression.

Proposed Change

During html rendering, detect all pages that are linked to by the page currently being rendered, and for each linked page, find its component, and add a prefetch link. Basically, we want the same functionality as Gatsby.Link.componentDidMount, but during html generation.

Implementation Ideas

  • Use react-side-effect. This would involve creating an alternate Gatsby Link that worked on the server. On componentDidMount, it would write the to URL to a Set, which we could use to figure out which pages/components need prefetching

Related Issues

@dja
Copy link

dja commented May 29, 2019

Just an added thought here that a proposed solution should support adding the appropriate links to headers for hosting plugins like gatsby-plugin-netlify.

@gatsbot
Copy link

gatsbot bot commented Jun 19, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jun 19, 2019
@gatsbot
Copy link

gatsbot bot commented Jun 30, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more.
Projects
None yet
Development

No branches or pull requests

3 participants