From 2afa3c8fcd8deabc511003fb7f15e71e221f3798 Mon Sep 17 00:00:00 2001 From: Sutu Sebastian <41998826+SutuSebastian@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:21:59 +0300 Subject: [PATCH] Exclude analytics from `examples` page (#1376) * fix: exclude analytics from `examples` page leading to page-load-count inception due to code preview examples iframe * chore: isolate fathom-script into client component + fix reliability of the pathname --- apps/web/app/layout.tsx | 15 +++++---------- apps/web/components/fathom-script.tsx | 12 ++++++++++++ 2 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 apps/web/components/fathom-script.tsx diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index 3e25de0c3..aa0ce6744 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,7 +1,8 @@ import { ThemeModeScript } from "flowbite-react"; import { Inter as InterFont } from "next/font/google"; -import type { Metadata, NextPage, Viewport } from "next/types"; -import type { FC, PropsWithChildren } from "react"; +import type { Metadata, Viewport } from "next/types"; +import type { PropsWithChildren } from "react"; +import { FathomScript } from "~/components/fathom-script"; import "~/styles/globals.css"; @@ -53,7 +54,7 @@ export const viewport: Viewport = { ], }; -const RootLayout: NextPage = ({ children }) => { +export default function RootLayout({ children }: PropsWithChildren) { return ( @@ -65,10 +66,4 @@ const RootLayout: NextPage = ({ children }) => { ); -}; - -const FathomScript: FC = () => { - return