Skip to content

Optimize GitHub Avatars with Next.js Image Component#8184

Open
kanishka-2007-tech wants to merge 1 commit into
JhaSourav07:mainfrom
kanishka-2007-tech:avatar
Open

Optimize GitHub Avatars with Next.js Image Component#8184
kanishka-2007-tech wants to merge 1 commit into
JhaSourav07:mainfrom
kanishka-2007-tech:avatar

Conversation

@kanishka-2007-tech

@kanishka-2007-tech kanishka-2007-tech commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description

GitHub avatar images across 7 components were rendered using raw HTML tags, bypassing Next.js built-in image optimization. This resulted in:

No automatic WebP/AVIF format conversion
No lazy loading out of the box
No responsive sizing
Higher bandwidth usage and slower LCP (Largest Contentful Paint) scores

The next.config.ts already had both avatars.githubusercontent.com and github.com configured under remotePatterns, meaning the optimization infrastructure was ready — just not being used.

Every GitHub avatar across the dashboard, leaderboard, burnout analyzer, and developer arena will now be:

Served as WebP/AVIF automatically where the browser supports it
Lazy loaded by default (images below the fold don't block rendering)
Properly sized to avoid layout shift (explicit width/height on every )

Fixes #3696

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

@kanishka-2007-tech is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@retenta-bot

retenta-bot Bot commented Jul 19, 2026

Copy link
Copy Markdown

This PR enhances the performance of GitHub avatar rendering by leveraging Next.js's built-in image optimization capabilities. It addresses issues related to bandwidth usage and loading performance, which is crucial for user experience. Additionally, it aligns with previous decisions made to improve performance and caching strategies in the repository. Thank you for your contribution, and I look forward to your updates!

@retenta-bot retenta-bot Bot changed the title fix: replace raw <img> tags with Next.js <Image> component for GitHub avatar optimization Optimize GitHub Avatars with Next.js Image Component Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

Asset PR Size Base Size Difference Status
static/chunks/130-[hash].js - 3.04 KB -3.04 KB (-100.00%) 🗑️ Deleted
static/chunks/2045-[hash].js 5.65 KB - +5.65 KB (++100%) 🆕 New
static/chunks/2561-[hash].js - 10.54 KB -10.54 KB (-100.00%) 🗑️ Deleted
static/chunks/2705-[hash].js - 5.87 KB -5.87 KB (-100.00%) 🗑️ Deleted
static/chunks/2896-[hash].js 24.47 KB - +24.47 KB (++100%) 🆕 New
static/chunks/4200-[hash].js - 10.25 KB -10.25 KB (-100.00%) 🗑️ Deleted
static/chunks/4305-[hash].js 16.26 KB 16.27 KB -0.01 KB (-0.05%) 🟢 Improvement
static/chunks/5547-[hash].js 2.44 KB - +2.44 KB (++100%) 🆕 New
static/chunks/6559-[hash].js 10.41 KB - +10.41 KB (++100%) 🆕 New
static/chunks/8429-[hash].js 10.12 KB - +10.12 KB (++100%) 🆕 New
static/chunks/8607-[hash].js - 2.27 KB -2.27 KB (-100.00%) 🗑️ Deleted
static/chunks/8679-[hash].js - 24.64 KB -24.64 KB (-100.00%) 🗑️ Deleted
static/chunks/9381-[hash].js 2.90 KB - +2.90 KB (++100%) 🆕 New
static/chunks/app/(root)/dashboard/[username]/wrapped/page-[hash].js 3.12 KB 2.97 KB +0.15 KB (+5.04%) 🔴 Regression
static/chunks/app/page-[hash].js 21.02 KB 20.63 KB +0.39 KB (+1.91%) 🔴 Regression

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3975.40 KB 3975.85 KB -0.45 KB (-0.01%)
Total CSS 331.16 KB 331.16 KB 0 B

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.

Replace raw img tags with Next.js Image component for avatars

1 participant