Skip to content

Commit

Permalink
chore(react): add fix in useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
savindi7 committed Jun 23, 2023
1 parent 4472f65 commit ea95036
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

import {PropsWithChildren} from 'react';
import {PropsWithChildren, useEffect} from 'react';
import {addParameters, Story, StoryContext} from '@storybook/react';
import {DocsContainer, DocsContainerProps, DocsPage} from '@storybook/addon-docs';
import {
Expand All @@ -37,7 +37,9 @@ import {extendTheme} from '../src/theme';
*/
const withProviders = (Story: Story, context: StoryContext) => {
// Set 'oxygen-mode' to the Storybook theme
localStorage.setItem('oxygen-mode', JSON.parse(localStorage.getItem('sb-addon-themes-3'))?.current);
useEffect(() => {
localStorage.setItem('oxygen-mode', JSON.parse(localStorage.getItem('sb-addon-themes-3'))?.current);
}, []);

return (
<ThemeProvider
Expand Down

0 comments on commit ea95036

Please sign in to comment.