Skip to content

Add environment-specific favicons#369

Merged
huv1k merged 1 commit into
mainfrom
huv1k/env-favicon-svg
Jun 9, 2026
Merged

Add environment-specific favicons#369
huv1k merged 1 commit into
mainfrom
huv1k/env-favicon-svg

Conversation

@huv1k

@huv1k huv1k commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Adds environment-specific favicon selection from VERCEL_ENV.
Moves the default production favicon to public/favicon.ico and adds root-level preview/development .ico variants with darker tinted backgrounds.

CleanShot 2026-06-09 at 15 27 00@2x

Validation

  • bun vitest run tests/unit/favicon.test.ts
  • bun run check

@cla-bot cla-bot Bot added the cla-signed label Jun 9, 2026
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 9, 2026 1:41pm
web-juliett Ready Ready Preview, Comment Jun 9, 2026 1:41pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abb7bfe53b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/configs/favicon.ts
Comment on lines +12 to +13
preview: '/favicon-preview.ico',
development: '/favicon-development.ico',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exempt the new favicon variants from proxy auth

In preview/development the metadata now points browsers at /favicon-preview.ico or /favicon-development.ico, but I checked src/proxy.ts and its matcher only excludes the exact favicon.ico path plus common image extensions, not other .ico files. Those static icon requests will therefore enter proxyCore and fall through to handleAuthGate, which calls createAuthForProxy(...).getAuthContext() before NextResponse.next(), adding auth/session work to every page load just to serve a public asset. Please extend the proxy exclusion to cover these new .ico paths or all .ico assets.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds environment-specific favicon selection based on VERCEL_ENV, so production/preview/development environments can display distinct favicon variants.

Changes:

  • Introduces a centralized favicon config (getFaviconEnvironment, getFaviconHref, size/type constants).
  • Wires the selected favicon into the App Router metadata.icons in the root layout.
  • Adds unit tests validating favicon environment resolution and href selection.

Reviewed changes

Copilot reviewed 3 out of 7 changed files in this pull request and generated 2 comments.

File Description
src/configs/favicon.ts Defines environment-to-favicon mapping and helper functions used by the app.
src/app/layout.tsx Exports metadata to set the favicon dynamically via Next.js metadata API.
tests/unit/favicon.test.ts Adds unit tests for environment resolution and favicon href selection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/configs/favicon.ts
Comment on lines +10 to +14
const FAVICON_HREFS = {
production: '/favicon.ico',
preview: '/favicon-preview.ico',
development: '/favicon-development.ico',
} as const satisfies Record<FaviconEnvironment, string>
Comment thread tests/unit/favicon.test.ts
@huv1k huv1k force-pushed the huv1k/env-favicon-svg branch from abb7bfe to c0099b8 Compare June 9, 2026 13:40
@huv1k huv1k merged commit 10882e1 into main Jun 9, 2026
14 checks passed
@huv1k huv1k deleted the huv1k/env-favicon-svg branch June 9, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants