Skip to content

Commit 39d3559

Browse files
committed
chore: PR review
1 parent 037baff commit 39d3559

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/2023/Home/components/SpeakersCarousel/SpeakerSwiper.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC } from "react";
1+
import React, { FC } from "react";
22
import { Autoplay, Parallax } from "swiper";
33
import { Swiper, SwiperSlide } from "swiper/react";
44
import styled from "styled-components";
@@ -61,9 +61,9 @@ const SpeakerSwiper: FC<React.PropsWithChildren<unknown>> = () => {
6161
conferenceData.sessionizeUrl,
6262
);
6363

64-
const swiperSpeakers: ISpeaker[] = data
65-
? shuffleArray(data).slice(0, 20)
66-
: [];
64+
const swiperSpeakers: ISpeaker[] = React.useMemo(() => data
65+
? shuffleArray(data).slice(0, 20)
66+
: [], [data]);
6767

6868
useSentryErrorReport(error);
6969

src/components/Swiper/SpeakerSwiper.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ const SpeakerSwiper: FC<React.PropsWithChildren<unknown>> = () => {
4242
conferenceData.sessionizeUrl,
4343
);
4444

45-
const cachedSpeakers: ISpeaker[] = data
46-
? shuffleArray(data).slice(0, 20)
47-
: [];
45+
const cachedSpeakers: ISpeaker[] = React.useMemo(() => data
46+
? shuffleArray(data).slice(0, 20)
47+
: [], [data]);
4848

4949
useSentryErrorReport(error);
5050

0 commit comments

Comments
 (0)