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

[gatsby-link] Add a callback for preloading #17952

Closed
onestopjs opened this issue Sep 27, 2019 · 8 comments
Closed

[gatsby-link] Add a callback for preloading #17952

onestopjs opened this issue Sep 27, 2019 · 8 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.

Comments

@onestopjs
Copy link
Contributor

Summary

Add a callback to Gatsby Link for preloading

Basic example

const preloadFunction = () => console.log('preloading');

<Link to="/some-page" onPreload={preloadFunction}>Some page</Link>

Motivation

Gatsby Link uses IntersectionObserver to preload linked pages which are visible. I think it would be really useful to be able to pass a callback function to Gatsby Link which will be called when preloading has been triggered.

In my plugin gatsby-theme-localization I have a wrapper for Gatsby Link which preloads namespaces on hover. However, it is not sufficient as Gatsby preloads page data earlier. Having such callback would enable me to preload namespaces whenever Gatsby decides to.

I am sure that there are many other use cases where this would be really valuable.

I am more than willing to work on this if people agree that it would be a nice feature.

@onestopjs onestopjs assigned onestopjs and unassigned onestopjs Sep 27, 2019
@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Oct 18, 2019
@gatsbot
Copy link

gatsbot bot commented Oct 18, 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! 💪💜

@onestopjs onestopjs added not stale and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Oct 21, 2019
@LekoArts LekoArts added help wanted Issue with a clear description that the community can help with. type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. and removed not stale labels May 25, 2020
@github-actions
Copy link

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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jun 20, 2020
@jzabala
Copy link
Contributor

jzabala commented Jun 24, 2020

I would like to take this one 🙂

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Jun 25, 2020
@github-actions
Copy link

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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jul 15, 2020
@github-actions
Copy link

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! 💪💜

@wardpeet wardpeet removed help wanted Issue with a clear description that the community can help with. stale? Issue that may be closed soon due to the original author not responding any more. labels Oct 2, 2020
@wardpeet
Copy link
Contributor

wardpeet commented Oct 2, 2020

Hey @jzabala & @onestopjs,

Could you clarify a little bit more about what benefit this would give you? I don't think this is the right approach to get to the solution you're after. This would fix your issue in certain cases but you would need to add onPreload for the same link every time. Let's say you have a header & footer navigation, it means you'll have to add onPreload to both on them to make it work 💯.

For me it seems like we're missing some preload apis to attach to a route.

@wardpeet wardpeet reopened this Oct 2, 2020
@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 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.
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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Oct 22, 2020
@github-actions
Copy link

github-actions bot commented Dec 2, 2020

Hey again!

It’s been 60 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 comment on 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! 💪💜

@github-actions github-actions bot closed this as completed Dec 2, 2020
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. type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Projects
None yet
Development

No branches or pull requests

5 participants