File tree 1 file changed +6
-1
lines changed
src/components/search/SearchBar
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -82,9 +82,13 @@ const SearchBar = ({
82
82
] ;
83
83
const [ searchBarHintIndex , setSearchBarHintIndex ] = useState < number > ( 1 ) ;
84
84
85
+ function changeHint ( ) {
86
+ setSearchBarHintIndex ( Math . floor ( Math . random ( ) * 4 ) ) ;
87
+ }
88
+
85
89
useEffect ( ( ) => {
86
90
const interval = setInterval ( ( ) => {
87
- setSearchBarHintIndex ( Math . floor ( Math . random ( ) * 4 ) ) ;
91
+ changeHint ( ) ;
88
92
} , 7000 ) ;
89
93
90
94
return ( ) => clearInterval ( interval ) ; // Cleanup when component unmounts
@@ -112,6 +116,7 @@ const SearchBar = ({
112
116
//update parent and queries
113
117
function onSelect_internal ( newValue : SearchQuery [ ] ) {
114
118
// called by updateValue(), handleKeyDown(), and is assigned to the button onClick action
119
+ changeHint ( ) ;
115
120
if (
116
121
router . query . searchTerms ==
117
122
newValue . map ( ( el ) => searchQueryLabel ( el ) ) . join ( ',' )
You can’t perform that action at this time.
0 commit comments