diff --git a/src/components/pages/sandbox/roulette/Roulette.tsx b/src/components/pages/sandbox/roulette/Roulette.tsx index e8f56a60..c5eaaddf 100644 --- a/src/components/pages/sandbox/roulette/Roulette.tsx +++ b/src/components/pages/sandbox/roulette/Roulette.tsx @@ -8,6 +8,8 @@ import AliceCarousel from '../../../../lib/react-alice-carousel'; import { shuffleArray, genItems, genRandomInt } from './Roulette.utils'; import type { Props, Item } from './Roulette.types'; +let timeoutId: null | NodeJS.Timeout = null; + const responsive = { 0: { items: 1 }, 640: { items: 3 }, @@ -33,7 +35,7 @@ function getOffset(itemsOnScreen: number) { function loadWinner() { return new Promise<{ id: number }>((resolve) => { - setTimeout(() => resolve({ id: genRandomInt() }), 2_000); + timeoutId = setTimeout(() => resolve({ id: genRandomInt() }), 2_000); }); } @@ -125,9 +127,12 @@ export default function SandboxPage(props: Partial) {