Skip to content

feat: optimized image loading with Next.js Image component #819

Open
harshhgithub wants to merge 13 commits intoasyncapi:masterfrom
harshhgithub:lazy-loading
Open

feat: optimized image loading with Next.js Image component #819
harshhgithub wants to merge 13 commits intoasyncapi:masterfrom
harshhgithub:lazy-loading

Conversation

@harshhgithub
Copy link
Copy Markdown
Contributor

@harshhgithub harshhgithub commented Oct 19, 2025

Resolves: #796
This PR further improves the website’s image performance and perceived load speed by introducing blur placeholders and a custom image loader across pages.

Changes Made-
Added loader prop using a custom loader for fallback handling.
Implemented placeholder="blur" and blurDataURL for key images (e.g., hero, popup, and rocket GIF).
Ensured all tags are now replaced by optimized components.
Verified above-the-fold images still use the priority prop.

Verification-
Lighthouse score improved for image metrics.
Verified blur placeholders appear before full image load.
No layout shifts or broken visuals.

@harshhgithub harshhgithub changed the title feat: Optimize image loading with Next.js Image component feat: optimized image loading with Next.js Image component Oct 19, 2025
@netlify
Copy link
Copy Markdown

netlify bot commented Oct 19, 2025

Deploy Preview for peaceful-ramanujan-288045 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2569a2c
🔍 Latest deploy log https://app.netlify.com/projects/peaceful-ramanujan-288045/deploys/68f48ca6e11c14000877ca55
😎 Deploy Preview https://deploy-preview-819--peaceful-ramanujan-288045.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 19, 2025

Deploy Preview for peaceful-ramanujan-288045 failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 5d02402
🔍 Latest deploy log https://app.netlify.com/projects/peaceful-ramanujan-288045/deploys/6949289d16241a0008f3f0c3

Copy link
Copy Markdown
Member

@AceTheCreator AceTheCreator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harshhgithub your PR is not addressing the issue thread 🤔

@harshhgithub
Copy link
Copy Markdown
Contributor Author

@harshhgithub your PR is not addressing the issue thread 🤔

Thanks for the feedback, @AceTheCreator! 🙏
You're absolutely right — Next.js handles lazy loading by default. I’ll extend the component using the loader prop so that users on slower connections can see a placeholder (e.g., blurred or default image) while the main image loads.

I’ll update the PR accordingly and push the changes soon .

@harshhgithub
Copy link
Copy Markdown
Contributor Author

@AceTheCreator please review

Copy link
Copy Markdown
Member

@AceTheCreator AceTheCreator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harshhgithub I think you may want to reconsider your approach. Instead of using a fallback image, which will still need to load on the initial render, you could just blur it: Here’s a great tutorial showing how someone implemented it: https://www.meje.dev/blog/nextjs-image-blur-on-load

@harshhgithub
Copy link
Copy Markdown
Contributor Author

@AceTheCreator Thanks for the feedback!
I’ve updated the implementation to avoid fallback image downloads and switched to a blur-on-load approach using the onLoad API from Next.js image.

@harshhgithub
Copy link
Copy Markdown
Contributor Author

@AceTheCreator any review on this

Comment on lines +14 to +15
const [isLogoLoading, setLogoLoading] = useState<boolean>(true);
const [isRocketLoading, setRocketLoading] = useState<boolean>(true);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to create states. you can just use placeholder="blur" on the Image tag.
also resolve the conflict

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.

[FEATURE] Implement Lazy Loading for Images

4 participants