fix: return null when data is still loading

This commit is contained in:
2024-04-21 01:25:09 +02:00
parent ebf5733774
commit 04de7af6c3

View File

@@ -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>;
}