Skip to content

Commit 647dde5

Browse files
authored
Merge pull request #245 from UTDNebula/210-feature-request-on-a-new-search-switch-to-the-newest-source-of-information-professorcourse-overview-tab-on-the-rhs
on a new search changes focus to the first tab (index 0) to show new information
2 parents 3b9ebe7 + 29111b9 commit 647dde5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/components/common/Carousel/carousel.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ReactJSXElement } from '@emotion/react/types/jsx-namespace';
22
import { AnimatePresence, motion } from 'framer-motion';
3-
import React, { useState } from 'react';
3+
import React, { useEffect, useState } from 'react';
44

55
import { TabNavMenu } from '../../navigation/tabNavMenu/tabNavMenu';
66

@@ -44,6 +44,10 @@ const Carousel = ({ names, children }: CarouselProps) => {
4444
// The Direction that the card is moving in
4545
const [direction, setDirection] = useState(0);
4646

47+
useEffect(() => {
48+
setCurrentCard(0);
49+
}, [children]);
50+
4751
/**
4852
* On each re-render, ensure currentCard is within valid bounds
4953
*/

0 commit comments

Comments
 (0)