Skip to content

Commit

Permalink
chore: suspense with fallback for mobile lazy TopAlert
Browse files Browse the repository at this point in the history
  • Loading branch information
benax-se committed Nov 10, 2024
1 parent 4b9d958 commit d579d9f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/MobileHeader/MobileHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import React, {Suspense, useCallback, useEffect, useMemo, useState} from 'react';

import {useForwardRef} from '../../hooks/useForwardRef';
import {Content, RenderContentType} from '../Content';
Expand Down Expand Up @@ -268,7 +268,11 @@ export const MobileHeader = React.forwardRef<HTMLDivElement, MobileHeaderProps>(
return (
<div className={b({compact}, className)} ref={targetRef}>
<div className={b('top')}>
{topAlert && <TopAlert alert={topAlert} />}
{topAlert && (
<Suspense fallback={null}>
<TopAlert alert={topAlert} />
</Suspense>
)}
<header className={b('header')} style={{height: size}}>
<Burger
opened={visiblePanel === burgerPanelItem.id}
Expand Down

0 comments on commit d579d9f

Please sign in to comment.