File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed
Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ const HomePage = ({
2727 const dispatch = useDispatch ( ) ;
2828
2929 const [ techParams , setTechParams ] = useState ( isTech ) ;
30+ const [ previousTechParams , setPreviousTechParams ] = useState ( isTech ) ;
3031
3132 const onSelectTech = ( value ) => {
3233 setIsLoading ( true ) ;
@@ -36,21 +37,20 @@ const HomePage = ({
3637
3738 useEffect ( ( ) => {
3839 if ( domains . length === 0 ) {
39- if ( isTech === 'init' ) {
40- ( async ( ) => {
41- await fetchDomains ( 0 , false , isTech ) ;
42- setIsLoading ( false ) ;
43- } ) ( ) ;
44- } else {
45- ( async ( ) => {
46- await fetchDomains ( 0 , false , isTech ) ;
47- setIsLoading ( false ) ;
48- } ) ( ) ;
49- }
50- } else {
40+ ( async ( ) => {
41+ await fetchDomains ( 0 , false , isTech ) ;
42+ setIsLoading ( false ) ;
43+ } ) ( ) ;
44+ }
45+ else if ( previousTechParams !== isTech ) {
46+ ( async ( ) => {
47+ await fetchDomains ( 0 , false , isTech ) ;
48+ setIsLoading ( false ) ;
49+ } ) ( ) ;
50+ }
51+ else {
5152 setIsLoading ( false ) ;
5253 }
53- // eslint-disable-next-line react-hooks/exhaustive-deps
5454 } , [ fetchDomains , isTech ] ) ;
5555
5656 if ( isLoading ) return < Loading /> ;
You can’t perform that action at this time.
0 commit comments