mirror of
https://github.com/ershisan99/podcaster.git
synced 2025-12-16 20:59:26 +00:00
fix: return null when data is still loading
This commit is contained in:
@@ -5,7 +5,7 @@ import { PodcastInfoCard } from "../components/podcast-info-card";
|
||||
export function Podcast() {
|
||||
const { podcastId } = useParams<{ podcastId: string }>();
|
||||
|
||||
const { data: podcast } = usePodcastQuery(podcastId);
|
||||
const { data: podcast, isLoading } = usePodcastQuery(podcastId);
|
||||
|
||||
if (!podcastId) {
|
||||
throw new Error(
|
||||
@@ -13,6 +13,10 @@ export function Podcast() {
|
||||
);
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!podcast) {
|
||||
return <h1>Podcast not found</h1>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user