Skip to content

Commit

Permalink
Demo Next.js setup should use only one cache
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Oct 2, 2022
1 parent c03a141 commit f58502e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
18 changes: 5 additions & 13 deletions src/test/apps/ssr/pages/_app.tsx
Expand Up @@ -6,21 +6,13 @@ import { createTheme } from "@mui/material/styles";
import CssBaseline from "@mui/material/CssBaseline";
import { useIsDarkModeEnabled, withIsDarkModeEnabled } from "../shared/isDarkModeEnabled";
import { createEmotionSsrAdvancedApproach } from "tss-react/next";
import { TssCacheProvider } from "tss-react";

const {
augmentDocumentWithEmotionCache: augmentDocumentWithEmotionCache_mui,
withAppEmotionCache: withAppEmotionCache_mui
} = createEmotionSsrAdvancedApproach({ "key": "mui", "prepend": true });
augmentDocumentWithEmotionCache,
withAppEmotionCache
} = createEmotionSsrAdvancedApproach({ "key": "css" });

export { augmentDocumentWithEmotionCache_mui };

const {
augmentDocumentWithEmotionCache: augmentDocumentWithEmotionCache_tss,
withAppEmotionCache: withAppEmotionCache_tss
} = createEmotionSsrAdvancedApproach({ "key": "tss" }, TssCacheProvider);

export { augmentDocumentWithEmotionCache_tss };
export { augmentDocumentWithEmotionCache };

export function App({ Component, pageProps }: AppProps) {

Expand Down Expand Up @@ -74,4 +66,4 @@ export function App({ Component, pageProps }: AppProps) {

}

export default withAppEmotionCache_mui(withAppEmotionCache_tss(withIsDarkModeEnabled(App)));
export default withAppEmotionCache(withIsDarkModeEnabled(App));
7 changes: 2 additions & 5 deletions src/test/apps/ssr/pages/_document.tsx
@@ -1,9 +1,6 @@
import Document from "next/document";
import { augmentDocumentWithEmotionCache_mui, augmentDocumentWithEmotionCache_tss } from "./_app";
import { augmentDocumentWithEmotionCache } from "./_app";

augmentDocumentWithEmotionCache_mui(Document);
augmentDocumentWithEmotionCache_tss(Document);
augmentDocumentWithEmotionCache(Document);

export default Document;


0 comments on commit f58502e

Please sign in to comment.