From 58a48098e9714f781e781d7e175b3e175cb2ed4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Tue, 15 Nov 2022 23:17:34 +0100 Subject: [PATCH] fix: respect color scheme in SSR --- gatsby-ssr.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gatsby-ssr.ts diff --git a/gatsby-ssr.ts b/gatsby-ssr.ts new file mode 100644 index 0000000..5215fac --- /dev/null +++ b/gatsby-ssr.ts @@ -0,0 +1,7 @@ +import React from "react" +import { GatsbySSR } from "gatsby" +import { getInitColorSchemeScript } from "@mui/material" + +export const onRenderBody: GatsbySSR["onRenderBody"] = ({ setPreBodyComponents }) => { + setPreBodyComponents([getInitColorSchemeScript()]) +}