mirror of
https://github.com/ershisan99/podcaster.git
synced 2025-12-18 05:09:30 +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() {
|
export function Podcast() {
|
||||||
const { podcastId } = useParams<{ podcastId: string }>();
|
const { podcastId } = useParams<{ podcastId: string }>();
|
||||||
|
|
||||||
const { data: podcast } = usePodcastQuery(podcastId);
|
const { data: podcast, isLoading } = usePodcastQuery(podcastId);
|
||||||
|
|
||||||
if (!podcastId) {
|
if (!podcastId) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -13,6 +13,10 @@ export function Podcast() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!podcast) {
|
if (!podcast) {
|
||||||
return <h1>Podcast not found</h1>;
|
return <h1>Podcast not found</h1>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user