🐛 Fix not found page not rendering properly (#1308)

This commit is contained in:
Luke Vella 2024-09-05 19:31:26 +01:00 committed by GitHub
parent d40d4b27e2
commit 2ab67d819c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 4 deletions

View file

@ -1,5 +1,5 @@
"use client";
import { useParams, useSearchParams } from "next/navigation";
import { notFound, useParams, useSearchParams } from "next/navigation";
import React from "react";
import { LegacyPollContextProvider } from "@/components/poll/poll-context-provider";
@ -35,7 +35,7 @@ const Prefetch = ({ children }: React.PropsWithChildren) => {
const comments = trpc.polls.comments.list.useQuery({ pollId: urlId });
if (error?.data?.code === "NOT_FOUND") {
return <div>Not found</div>;
notFound();
}
if (!poll || !participants || !comments.isFetched) {
return <Loader />;

View file

@ -1,6 +1,5 @@
import { prisma } from "@rallly/database";
import { Metadata } from "next";
import { notFound } from "next/navigation";
import { InvitePage } from "@/app/[locale]/invite/[urlId]/invite-page";
import { getTranslation } from "@/app/i18n";
@ -36,7 +35,7 @@ export async function generateMetadata({
const { t } = await getTranslation(locale);
if (!poll) {
return notFound();
return null;
}
const { title, id, user } = poll;