diff --git a/components/Header/components/Search/index.tsx b/components/Header/components/Search/index.tsx index df1bddd..4255718 100644 --- a/components/Header/components/Search/index.tsx +++ b/components/Header/components/Search/index.tsx @@ -10,7 +10,6 @@ import { Modal } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import useDistinctUntilChanged from '@/hooks/useDistinctUntilChanged'; -import { cn } from '@/lib/utils'; import useSearch from './useSearch'; @@ -36,13 +35,15 @@ export const showSearchModal = create(({ onResolve }) => { { title: 'Series', data: series, type: 'tv' as const } ].filter(({ data: { shows } }) => shows.length); + const isFetched = movies.isFetched && series.isFetched; + return (
{
- {tabs.length > 1 ? ( - - - {tabs.map(({ type, title }) => ( - - {title} - - ))} - - {tabs.map(({ data: { shows, fetchNextPage }, type }) => ( - + {isFetched && ( +
+ {tabs.length > 1 ? ( + + + {tabs.map(({ type, title }) => ( + + {title} + + ))} + + {tabs.map(({ data: { shows, fetchNextPage }, type }) => ( + + + + ))} + + ) : ( + tabs.map(({ data: { shows, fetchNextPage }, type }) => ( - - ))} - - ) : ( - tabs.map(({ data: { shows, fetchNextPage }, type }) => ( - - )) + )) + )} +
)}
); diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx index 57f554c..6018c24 100644 --- a/components/ui/dialog.tsx +++ b/components/ui/dialog.tsx @@ -175,6 +175,7 @@ const Modal: React.FC<{ {children} + );