@@ -26,13 +26,13 @@ export const Home = () => {
2626
2727 // GLOBAL SEARCH STATE
2828 const searchState = useSelector ( ( state : RootState ) => state . search ) ;
29- const isTextSearchActive = searchState . active && searchState . type === " text" ;
30- const isFaceSearchActive = searchState . active && searchState . type === " face" ;
31- const searchQuery = searchState . query || "" ;
29+ const isTextSearchActive = searchState . active && searchState . type === ' text' ;
30+ const isFaceSearchActive = searchState . active && searchState . type === ' face' ;
31+ const searchQuery = searchState . query || '' ;
3232
3333 // NORMAL FETCH — disabled during search
3434 const { data, isLoading, isSuccess, isError, error } = usePictoQuery ( {
35- queryKey : [ " images" ] ,
35+ queryKey : [ ' images' ] ,
3636 queryFn : ( ) => fetchAllImages ( ) ,
3737 enabled : ! searchState . active ,
3838 } ) ;
@@ -56,11 +56,11 @@ export const Home = () => {
5656 error,
5757 } ,
5858 {
59- loadingMessage : " Loading images" ,
59+ loadingMessage : ' Loading images' ,
6060 showSuccess : false ,
61- errorTitle : " Error" ,
62- errorMessage : " Failed to load images. Please try again later." ,
63- }
61+ errorTitle : ' Error' ,
62+ errorMessage : ' Failed to load images. Please try again later.' ,
63+ } ,
6464 ) ;
6565
6666 // UPDATE IMAGES BASED ON STATE
@@ -69,7 +69,7 @@ export const Home = () => {
6969 if ( isTextSearchActive && searchSuccess ) {
7070 const images = ( searchData ?. data || [ ] ) as Image [ ] ;
7171 if ( ! Array . isArray ( images ) ) {
72- console . error ( " Invalid search data format" ) ;
72+ console . error ( ' Invalid search data format' ) ;
7373 return ;
7474 }
7575 dispatch ( setImages ( images ) ) ;
@@ -81,14 +81,22 @@ export const Home = () => {
8181 const images = ( data ?. data || [ ] ) as Image [ ] ;
8282 dispatch ( setImages ( images ) ) ;
8383 }
84- } , [ dispatch , searchData , data ] ) ;
84+ } , [
85+ dispatch ,
86+ searchData ,
87+ data ,
88+ isTextSearchActive ,
89+ searchSuccess ,
90+ searchState . active ,
91+ isSuccess ,
92+ ] ) ;
8593
8694 // TITLE
8795 const title = isTextSearchActive
8896 ? `Search Results for "${ searchQuery } " (${ images . length } found)`
8997 : isFaceSearchActive && images . length > 0
90- ? `Face Search Results (${ images . length } found)`
91- : " Image Gallery" ;
98+ ? `Face Search Results (${ images . length } found)`
99+ : ' Image Gallery' ;
92100
93101 return (
94102 < div className = "relative flex h-full flex-col pr-6" >
0 commit comments