File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
packages/shared/src/components Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { lazy , Suspense } from 'react' ;
22import { useQuery } from '@tanstack/react-query' ;
33import type { LottieComponentProps } from 'lottie-react' ;
44import type { ReactElement } from 'react' ;
5- import dynamic from 'next/dynamic' ;
65import { RequestKey } from '../lib/query' ;
76import { disabledRefetch } from '../lib/func' ;
87import { fromCDN } from '../lib' ;
@@ -11,9 +10,9 @@ export type LottieAnimationProps = {
1110 className ?: string ;
1211 src : string ;
1312 basePath ?: string ;
14- } & Omit < LottieComponentProps , 'animationData' | 'width' | 'height' > ;
13+ } & Omit < LottieComponentProps , 'animationData' | 'width' | 'height' | 'ref' > ;
1514
16- const Lottie = dynamic (
15+ const Lottie = lazy (
1716 ( ) => import ( /* webpackChunkName: "lottieReact" */ 'lottie-react' ) ,
1817) ;
1918
@@ -51,12 +50,14 @@ export const LottieAnimation = ({
5150 } ) ;
5251
5352 return (
54- < Lottie
55- { ...lottieProps }
56- className = { className }
57- loop = { loop }
58- autoplay = { autoplay }
59- animationData = { animationData }
60- />
53+ < Suspense fallback = { < div className = { className } /> } >
54+ < Lottie
55+ { ...lottieProps }
56+ className = { className }
57+ loop = { loop }
58+ autoplay = { autoplay }
59+ animationData = { animationData }
60+ />
61+ </ Suspense >
6162 ) ;
6263} ;
You can’t perform that action at this time.
0 commit comments