Skip to content

fix(themes): normalize theme query parameter lookup to make theme selection case-insensitive#6146

Merged
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
ChetanSenta:fix/case-insensitive-theme-param
Jun 21, 2026
Merged

fix(themes): normalize theme query parameter lookup to make theme selection case-insensitive#6146
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
ChetanSenta:fix/case-insensitive-theme-param

Conversation

@ChetanSenta

Copy link
Copy Markdown
Contributor

Description

Fixes #6143

Pillar

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

Visual Preview

No visual changes to the themes themselves. However, passing parameters like ?theme=CYANPULSE or ?theme=cyanpulse will now correctly load the cyanPulse theme style instead of crashing or breaking back to an unstyled fallback default state.

What this PR does

Previously, the incoming theme query parameter string was matched exactly against keys of the THEMES object. This meant strict case sensitivity was expected from end-users (cyanPulse worked, but cyanpulse or uppercase equivalents failed).

This PR introduces a getNormalizedThemeKey() utility inside lib/svg/themes.ts to scan and safely match theme names case-insensitively.

Changes

File Change
lib/svg/themes.ts Added getNormalizedThemeKey() case-insensitive lookup helper.
app/api/streak/route.ts Updated the API route handler to pass query input through the new safe resolver.
lib/svg/themes.test.ts Added 3 unit tests verifying lowercase, uppercase, and non-existent fallback handling.

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally.
  • I have run npm run format and npm run lint locally and resolved all errors.
  • My commits follow the Conventional Commits format.
  • My branch has only one clean commit to merge.

@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3694.34 KB 3694.34 KB 0 B
Total CSS 296.06 KB 296.06 KB 0 B

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Excellent fix to improve user experience. Normalizing the theme query parameter using getNormalizedThemeKey in lib/svg/themes.ts prevents unnecessary fallbacks when users make minor casing typos. The logic in app/api/streak/route.ts elegantly integrates this helper. Approved!

@Aamod-Dev Aamod-Dev added GSSoC 2026 mentor:Aamod007 level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. bug Something isn't working labels Jun 21, 2026
@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 21, 2026
@JhaSourav07 JhaSourav07 merged commit 7ce07f0 into JhaSourav07:main Jun 21, 2026
10 of 11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @ChetanSenta! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jun 21, 2026
@github-actions github-actions Bot added the type:bug Something isn't working as expected label Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gssoc:approved PR has been reviewed and accepted for valid contribution points GSSoC 2026 level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Theme parameter is case-sensitive — passing ?theme=CYANPULSE instead of ?theme=cyanPulse causes fallback failure or route mismatch

3 participants