diff --git a/app/root.tsx b/app/root.tsx index a4a46f4..edea97c 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -73,14 +73,13 @@ export function Layout({ children }: { children: React.ReactNode }) { const data = useRouteLoaderData('root') const error = useRouteError() const origin = data?.origin ?? window.location.origin - const hasJs = typeof document !== 'undefined' return ( {data?.appName === 'silvenon-staging' && ( diff --git a/app/services/dark-mode.tsx b/app/services/dark-mode.tsx index 2d5a7aa..077e903 100644 --- a/app/services/dark-mode.tsx +++ b/app/services/dark-mode.tsx @@ -24,7 +24,7 @@ function DarkModeProvider({ sessionValue, children }: ProviderProps) { const sessionFetcher = useFetcher({ key: FETCHER_KEY }) const optimisticSessionValueRef = useRef(undefined) const [matchesValue, setMatchesValue] = useState(() => { - if (typeof document === 'undefined') { + if (import.meta.env.SSR) { // there's no way for us to know what the theme should be in this context // the client will have to figure it out before hydration. return null