File tree 1 file changed +8
-3
lines changed 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import 'react-loading-skeleton/dist/skeleton.css';
4
4
5
5
import ThemeCard from '../components/Themes/ThemeCard' ;
6
6
import SearchBar from '../components/SearchBar/SearchBar' ;
7
- import useFetchData from '../hooks/useFetchThemes' ;
7
+ import useFetchData , { fetchThemesFromApi } from '../hooks/useFetchThemes' ;
8
8
import { Endpoints } from '../constants/Endpoints' ;
9
9
import { useSearchParams } from 'react-router-dom' ;
10
10
import ThemePreview from '../components/Themes/ThemePreview' ;
@@ -54,9 +54,14 @@ const Themes: React.FC = () => {
54
54
}
55
55
const focusedThemeObject = themes . find ( theme => theme . id === focusedThemeId ) ;
56
56
if ( ! focusedThemeObject ) {
57
- return
57
+ //check if it exists in the list we havent search for yet
58
+ fetchThemesFromApi ( undefined , 1 , 1 , focusedThemeId ) . then (
59
+ themes => setFocusedTheme ( themes [ 0 ] )
60
+ )
61
+ } else {
62
+ setFocusedTheme ( focusedThemeObject )
58
63
}
59
- setFocusedTheme ( focusedThemeObject )
64
+
60
65
61
66
} , [ themes ] )
62
67
You can’t perform that action at this time.
0 commit comments