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-plugin-image] does not trigger onLoad on GatsbyImage #30937
Comments
Hi! Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it. If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look. Thanks for using Gatsby! 💜 |
Hey @LekoArts, this is the minimal reproduction site. In the above repo, we have 2 pages:
Now, once redirected back to |
I'm seeing the same thing. Navigating back to a page that uses Note this worked fine with the older Also note that this exhibits on the development server as well as on a build. |
There's a solution to a similar problem in Next.js, which involves attaching a However when I try this on a
Is it possible to pass |
Potentially that behaviour made on purpose(cc @LekoArts ).
When you switches between pages there is no additional request happens because image has been cached already, and kinda there is no need for loading it. Which is definitely quite confusing. However there is another event - onStartLoad. That event fires every time, even on page change and has a As a workaround you can use combination of onStartLoad and onLoad in order to get information about image loading state. Ideally it would be great to have another event "onReady", that will be triggered no matter it is cached or just loaded. CleanShot.2021-10-31.at.19.57.02.mp4You can find the reproduction here |
@lnikell in the same time now not clear how to remove listener if use native one
|
The same solution for this situation |
Description
We have pages in which banner image has title and subtitle which shows once the image loads.
onLoad
event does not trigger while rendering page on second run.Steps to reproduce
Step 1. Navigate to
/about
page by clicking onAbout
in navigation bar from landing-pageStep 2. Redirect to landing-page by clicking on HOME (have
video
instead ofbanner image
in landing-page, onLoad works fine)Step 3. Now, redirect back to
/about
Expected result
Once redirected to
/about
inStep 3
, title and subtitle should be visible on banner imageActual result
Once redirected back to
/about
inStep 3
, title and subtitle are not visible on banner imageEnvironment
The text was updated successfully, but these errors were encountered: