From 04de7af6c3ea3db380029c191c655eb30c820a1e Mon Sep 17 00:00:00 2001 From: andres Date: Sun, 21 Apr 2024 01:25:09 +0200 Subject: [PATCH] fix: return null when data is still loading --- src/pages/podcast.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/podcast.tsx b/src/pages/podcast.tsx index 09db938..5ba8f3a 100644 --- a/src/pages/podcast.tsx +++ b/src/pages/podcast.tsx @@ -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

Podcast not found

; }