mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-10 07:38:04 -05:00
fix(frontend): hydration warning (#10120)
We're encountering a hydration warning on the frontend due to a mismatch in CSS module hashes. This happens because auto-generated classnames from `next/font` and `geist` differ between server-side and client-side rendering. The inconsistency triggers a warning when the client rehydrates the server-rendered HTML.  ### Changes 🏗️ Since the mismatch only affects the `<html>` tag and has no visible impact on the UI, the most straightforward workaround is to suppress the warning and still take advantage of `next/font` optimisations. ### 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 the frontend locally - [x] Page loads without hydration warnings --------- Co-authored-by: Abhimanyu Yadav <122007096+Abhi1992002@users.noreply.github.com>
This commit is contained in:
450
autogpt_platform/frontend/pnpm-lock.yaml
generated
450
autogpt_platform/frontend/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@ export default async function RootLayout({
|
||||
<html
|
||||
lang="en"
|
||||
className={`${fonts.poppins.variable} ${fonts.sans.variable} ${fonts.mono.variable}`}
|
||||
suppressHydrationWarning
|
||||
>
|
||||
<head>
|
||||
<GoogleAnalytics
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import { Poppins } from "next/font/google";
|
||||
import { GeistSans } from "geist/font/sans";
|
||||
import { GeistMono } from "geist/font/mono";
|
||||
import { GeistSans as geistSans } from "geist/font/sans";
|
||||
import { GeistMono as geistMono } from "geist/font/mono";
|
||||
|
||||
const poppins = Poppins({
|
||||
subsets: ["latin"],
|
||||
weight: ["400", "500", "600", "700"] as const,
|
||||
variable: "--font-poppins",
|
||||
display: "swap",
|
||||
preload: true,
|
||||
});
|
||||
|
||||
export const fonts = {
|
||||
poppins,
|
||||
sans: GeistSans,
|
||||
mono: GeistMono,
|
||||
sans: geistSans,
|
||||
mono: geistMono,
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@ const config = {
|
||||
fontFamily: {
|
||||
sans: ["var(--font-geist-sans)"],
|
||||
mono: ["var(--font-geist-mono)"],
|
||||
// Include the custom font family
|
||||
poppins: ["var(--font-poppins)"],
|
||||
},
|
||||
colors: {
|
||||
|
||||
Reference in New Issue
Block a user