diff --git a/apps/web/src/app/[locale]/invite/[urlId]/layout.tsx b/apps/web/src/app/[locale]/invite/[urlId]/layout.tsx index c7a3cdf49..9c0f29eb2 100644 --- a/apps/web/src/app/[locale]/invite/[urlId]/layout.tsx +++ b/apps/web/src/app/[locale]/invite/[urlId]/layout.tsx @@ -32,10 +32,12 @@ const Prefetch = ({ children }: React.PropsWithChildren) => { pollId: urlId, }); + const comments = trpc.polls.comments.list.useQuery({ pollId: urlId }); + if (error?.data?.code === "NOT_FOUND") { return
Not found
; } - if (!poll || !participants) { + if (!poll || !participants || !comments.isFetched) { return ; } diff --git a/apps/web/src/app/[locale]/invite/[urlId]/loading.tsx b/apps/web/src/app/[locale]/invite/[urlId]/loading.tsx index 4349ac3a6..7774fe2ac 100644 --- a/apps/web/src/app/[locale]/invite/[urlId]/loading.tsx +++ b/apps/web/src/app/[locale]/invite/[urlId]/loading.tsx @@ -1,3 +1,9 @@ +import { Spinner } from "@/components/spinner"; + export default function Loading() { - return null; + return ( +
+ +
+ ); } diff --git a/apps/web/src/app/[locale]/poll/[urlId]/skeleton.tsx b/apps/web/src/app/[locale]/poll/[urlId]/skeleton.tsx index 518391bd8..7774fe2ac 100644 --- a/apps/web/src/app/[locale]/poll/[urlId]/skeleton.tsx +++ b/apps/web/src/app/[locale]/poll/[urlId]/skeleton.tsx @@ -1,13 +1,9 @@ -import { PageContainer, PageHeader } from "@/app/components/page-layout"; -import { Skeleton } from "@/components/skeleton"; +import { Spinner } from "@/components/spinner"; export default function Loading() { return ( - - - - - - +
+ +
); } diff --git a/apps/web/src/components/layouts/poll-layout.tsx b/apps/web/src/components/layouts/poll-layout.tsx index a1456524d..7e9442527 100644 --- a/apps/web/src/components/layouts/poll-layout.tsx +++ b/apps/web/src/components/layouts/poll-layout.tsx @@ -144,8 +144,16 @@ const Prefetch = ({ children }: React.PropsWithChildren) => { const poll = trpc.polls.get.useQuery({ urlId }); const participants = trpc.polls.participants.list.useQuery({ pollId: urlId }); const watchers = trpc.polls.getWatchers.useQuery({ pollId: urlId }); + const comments = trpc.polls.comments.list.useQuery({ pollId: urlId }); + usePlan(); // prefetch plan - if (!poll.data || !watchers.data || !participants.data) { + + if ( + !poll.isFetched || + !watchers.isFetched || + !participants.isFetched || + !comments.isFetched + ) { return ; } diff --git a/apps/web/src/components/spinner.tsx b/apps/web/src/components/spinner.tsx index 9bd46cf84..ad7fbf93f 100644 --- a/apps/web/src/components/spinner.tsx +++ b/apps/web/src/components/spinner.tsx @@ -4,7 +4,10 @@ import { Loader2Icon } from "lucide-react"; export const Spinner = (props: { className?: string }) => { return ( ); };