Skip to content

Commit

Permalink
Remove colormode cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
thostetler committed Mar 27, 2024
1 parent 9156fd4 commit b495ae3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
6 changes: 1 addition & 5 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,11 @@ const NectarApp = memo(({ Component, pageProps }: AppProps): ReactElement => {

const Providers: FC<{ pageProps: AppPageProps }> = ({ children, pageProps }) => {
const createStore = useCreateStore(pageProps.dehydratedAppState ?? {});
const colorModeManager =
typeof pageProps.colorModeCookie === 'string'
? cookieStorageManagerSSR(pageProps.colorModeCookie)
: localStorageManager;

return (
<GoogleReCaptchaProvider reCaptchaKey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY ?? ''}>
<MathJaxProvider>
<ChakraProvider theme={theme} colorModeManager={colorModeManager}>
<ChakraProvider theme={theme}>
<StoreProvider createStore={createStore}>
<QCProvider>
<Hydrate state={pageProps.dehydratedState}>{children}</Hydrate>
Expand Down
7 changes: 0 additions & 7 deletions src/ssr-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ const injectNonce: IncomingGSSP = (ctx, prev) => {
return Promise.resolve({ props: { nonce, ...prev.props } });
};

const injectColorModeCookie: IncomingGSSP = (ctx, prev) => {
const colorMode = ctx.req.cookies['chakra-ui-color-mode'] ?? '';
log.debug({ msg: 'Injecting color mode from cookie', colorMode });
return Promise.resolve({ props: { colorModeCookie: `chakra-ui-color-mode=${colorMode}`, ...prev.props } });
};

const updateUserStateSSR: IncomingGSSP = (ctx, prevResult) => {
const userData = ctx.req.session.token;

Expand Down Expand Up @@ -70,7 +64,6 @@ export const composeNextGSSP = (...fns: IncomingGSSP[]) =>
> => {
fns.push(injectNonce);
fns.push(updateUserStateSSR);
fns.push(injectColorModeCookie);
api.setUserData(ctx.req.session.token);
let ssrProps = { props: {} };
for (const fn of fns) {
Expand Down

0 comments on commit b495ae3

Please sign in to comment.