Skip to content

Conversation

@amrelbialy
Copy link
Contributor

@amrelbialy amrelbialy commented Oct 14, 2025

πŸ”— Linked issue

resolves #1683

❓ Fix

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description
Resolved an issue where images could load more than once in the NuxtImg component. Previously, when a placeholder image was in use, it triggered a new image load even though the main image had already started loading. The update ensures that if a placeholder is already handled, we avoid loading the image again. This change prevents duplicate network requests and avoids unnecessary load events. By removing the preload using new image() instance and adding onLoad to imgAttrs, and using vue reactive to handle the update when placeholderLoaded is true

@amrelbialy amrelbialy requested a review from danielroe as a code owner October 14, 2025 15:43
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@1984

commit: 0b184f6

@Aurelien-GH
Copy link

Hi @danielroe
Can we have a look at this fix please, it's really needed on our side.
Thanks in advance for the feedback!

@danielroe
Copy link
Member

would you be able to add a regression test case in ssr.test.ts to reproduce the bug and make sure it doesn't happen again? πŸ™

@amrelbialy
Copy link
Contributor Author

@danielroe added

@amrelbialy
Copy link
Contributor Author

Hey @danielroe, any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Double image loaded with placeholder

3 participants