File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/views/Home/components/SpeakersCarousel Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const StyledSlideText = styled.p`
3838const SpeakerSwiper : FC < React . PropsWithChildren < unknown > > = ( ) => {
3939 const { isLoading, data, error } = useFetchSpeakers ( ) ;
4040
41- const swiperSpeakers = data ?. sort ( ( ) => 0.5 - Math . random ( ) ) . slice ( 0 , 20 ) ;
41+ const cachedSpeakers = React . useMemo ( ( ) => data ?. sort ( ( ) => 0.5 - Math . random ( ) ) . slice ( 0 , 20 ) , [ data ] ) ;
4242
4343 if ( error ) {
4444 Sentry . captureException ( error ) ;
@@ -47,7 +47,7 @@ const SpeakerSwiper: FC<React.PropsWithChildren<unknown>> = () => {
4747 return (
4848 < >
4949 { isLoading && < p > Loading</ p > }
50- { conferenceData . carrousel . enabled && swiperSpeakers && (
50+ { conferenceData . carrousel . enabled && cachedSpeakers && (
5151 < Swiper
5252 /*autoplay={{
5353 delay: 5000,
@@ -82,7 +82,7 @@ const SpeakerSwiper: FC<React.PropsWithChildren<unknown>> = () => {
8282 modules = { [ /*Autoplay,*/ Parallax ] }
8383 className = "mySwiper"
8484 >
85- { swiperSpeakers . map ( ( speaker ) => (
85+ { cachedSpeakers . map ( ( speaker ) => (
8686 < SwiperSlide key = { speaker . id } >
8787 < Link
8888 to = { `${ ROUTE_SPEAKER_DETAIL } /${ speaker . id } ` }
You can’t perform that action at this time.
0 commit comments