Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
isstuev committed Feb 26, 2025
1 parent 29e2f1b commit 443efb5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/contexts/chakra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import {
localStorageManager,
} from '@chakra-ui/react';
import type { ChakraProviderProps } from '@chakra-ui/react';
import { CacheProvider } from '@emotion/react';
import React from 'react';

import createEmotionCache from 'lib/createEmotionCache';
import theme from 'theme/theme';

const clientSideEmotionCache = createEmotionCache();

interface Props extends ChakraProviderProps {
cookies?: string;
}
Expand All @@ -19,8 +23,10 @@ export function ChakraProvider({ cookies, children }: Props) {
localStorageManager;

return (
<ChakraProviderDefault colorModeManager={ colorModeManager } theme={ theme }>
{ children }
</ChakraProviderDefault>
<CacheProvider value={ clientSideEmotionCache }>
<ChakraProviderDefault colorModeManager={ colorModeManager } theme={ theme }>
{ children }
</ChakraProviderDefault>
</CacheProvider>
);
}
11 changes: 11 additions & 0 deletions lib/createEmotionCache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// createEmotionCache.js
import createCache from '@emotion/cache';

import config from 'configs/app';

const uniqueKey = config.app.host;

// Use a unique key for each instance
export default function createEmotionCache() {
return createCache({ key: uniqueKey || 'css', prepend: true });
}

0 comments on commit 443efb5

Please sign in to comment.