From 4fa8cd89e26cdd5a52f8307ec34a3c2f033aba7b Mon Sep 17 00:00:00 2001 From: Sean Norwood Date: Mon, 4 Apr 2022 02:51:16 +0000 Subject: [PATCH] chore: external script work and comments --- tubearchivist/www/src/pages/_app.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tubearchivist/www/src/pages/_app.tsx b/tubearchivist/www/src/pages/_app.tsx index 8cfca59..b296d1a 100644 --- a/tubearchivist/www/src/pages/_app.tsx +++ b/tubearchivist/www/src/pages/_app.tsx @@ -2,7 +2,7 @@ import type { AppProps } from "next/app"; import { SessionProvider } from "next-auth/react"; import Script, { ScriptProps } from "next/script"; import "../styles/globals.css"; -import "../styles/dark.css"; +import "../styles/dark.css"; // TODO: Setup themeing the React way // TODO: Do these scripts need to be on every page? @@ -10,27 +10,32 @@ type ClientOnlyScriptProps = { src: string; } & ScriptProps; +/** + * This wraps next/script and returns early if `window` is not detected + * due to next using SSR + */ const ClientOnlyScript = ({ src, ...props }: ClientOnlyScriptProps) => { - if (typeof window !== "undefined") { - return