Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: move CacheProvider to ThemeProvider
  • Loading branch information
jaaydenh committed Dec 17, 2024
commit 18286d7067e38b072a874cd6503f9480e54dc9a1
31 changes: 11 additions & 20 deletions site/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import "./theme/globalFonts";
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import {
type FC,
Expand Down Expand Up @@ -40,11 +38,6 @@ declare global {
}
}

const cache = createCache({
key: "css",
prepend: true,
});

export const AppProviders: FC<AppProvidersProps> = ({
children,
queryClient = defaultQueryClient,
Expand All @@ -71,19 +64,17 @@ export const AppProviders: FC<AppProvidersProps> = ({
}, []);

return (
<CacheProvider value={cache}>
<HelmetProvider>
<QueryClientProvider client={queryClient}>
<AuthProvider>
<ThemeProvider>
{children}
<GlobalSnackbar />
</ThemeProvider>
</AuthProvider>
{showDevtools && <ReactQueryDevtools initialIsOpen={showDevtools} />}
</QueryClientProvider>
</HelmetProvider>
</CacheProvider>
<HelmetProvider>
<QueryClientProvider client={queryClient}>
<AuthProvider>
<ThemeProvider>
{children}
<GlobalSnackbar />
</ThemeProvider>
</AuthProvider>
{showDevtools && <ReactQueryDevtools initialIsOpen={showDevtools} />}
</QueryClientProvider>
</HelmetProvider>
);
};

Expand Down
1 change: 0 additions & 1 deletion site/src/contexts/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const ThemeProvider: FC<PropsWithChildren> = ({ children }) => {

useEffect(() => {
const root = document.documentElement;

if (themePreference === "auto") {
root.classList.add(preferredColorScheme);
} else {
Expand Down