Skip to content

Commit

Permalink
fix: mobile navigation ssr problem
Browse files Browse the repository at this point in the history
  • Loading branch information
gorgeousvlad committed Aug 1, 2023
1 parent a706cf5 commit 03abf1e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules
/server
/configure
/coverage
/widget
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ styles/styles.css
CHANGELOG.md
CONTRIBUTING.md
/coverage
/widget

# npm files
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import {Portal} from '@gravity-ui/uikit';

import Foldable from '../../../components/Foldable/Foldable';
import {useMount} from '../../../hooks';
import {block} from '../../../utils';
import {ItemColumnName, MobileNavigationProps, NavigationLayout} from '../../models';
import {NavigationList} from '../NavigationList/NavigationList';
Expand All @@ -17,7 +18,11 @@ const MobileNavigation: React.FC<MobileNavigationProps> = ({
bottomItems,
...props
}) => {
if (typeof window === 'undefined') {
const [isMounted, setIsMounted] = React.useState(false);

useMount(() => setIsMounted(true));

if (!isMounted) {
return null;
}

Expand Down

0 comments on commit 03abf1e

Please sign in to comment.