fix(frontend): favico colour override issue (#11681)

## Changes 🏗️

Sometimes, on Dev, when navigating between pages, the Favico colour
would revert from Green 🟢 (Dev) to Purple 🟣(Default). That's because the
`/marketplace` page had custom code overriding it that I didn't notice
earlier...

I also made it use the Next.js metadata API, so it handles the favicon
correctly across navigations.

## Checklist 📋

### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Run locally and test the above
This commit is contained in:
Ubbe
2025-12-30 20:22:32 +07:00
committed by GitHub
parent e26822998f
commit dff8efa35d
2 changed files with 14 additions and 19 deletions

View File

@@ -1,11 +1,11 @@
import { Metadata } from "next";
import { Suspense } from "react";
import {
prefetchGetV2ListStoreAgentsQuery,
prefetchGetV2ListStoreCreatorsQuery,
} from "@/app/api/__generated__/endpoints/store/store";
import { getQueryClient } from "@/lib/react-query/queryClient";
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
import { Metadata } from "next";
import { Suspense } from "react";
import { MainMarkeplacePage } from "./components/MainMarketplacePage/MainMarketplacePage";
import { MainMarketplacePageLoading } from "./components/MainMarketplacePageLoading";
@@ -48,11 +48,6 @@ export const metadata: Metadata = {
description: "Find and use AI Agents created by our community",
images: ["/images/store-twitter.png"],
},
icons: {
icon: "/favicon.ico",
shortcut: "/favicon-16x16.png",
apple: "/apple-touch-icon.png",
},
};
export default async function MarketplacePage(): Promise<React.ReactElement> {

View File

@@ -15,9 +15,21 @@ import { environment } from "@/services/environment";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { headers } from "next/headers";
const isDev = environment.isDev();
const isLocal = environment.isLocal();
const faviconPath = isDev
? "/favicon-dev.ico"
: isLocal
? "/favicon-local.ico"
: "/favicon.ico";
export const metadata: Metadata = {
title: "AutoGPT Platform",
description: "Your one stop shop to creating AI Agents",
icons: {
icon: faviconPath,
},
};
export default async function RootLayout({
@@ -27,8 +39,6 @@ export default async function RootLayout({
}>) {
const headersList = await headers();
const host = headersList.get("host") || "";
const isDev = environment.isDev();
const isLocal = environment.isLocal();
return (
<html
@@ -37,16 +47,6 @@ export default async function RootLayout({
suppressHydrationWarning
>
<head>
<link
rel="icon"
href={
isLocal
? "/favicon-local.ico"
: isDev
? "/favicon-dev.ico"
: "/favicon.ico"
}
/>
<SetupAnalytics
host={host}
ga={{