Suspenseful!

This commit is contained in:
Atridad Lahiji 2023-09-06 12:57:13 -06:00
parent 99d5c7ed61
commit dc9cc66a56
No known key found for this signature in database
4 changed files with 12 additions and 9 deletions

View file

@ -9,6 +9,10 @@ import { trpc } from "../_trpc/client";
import Loading from "./Loading"; import Loading from "./Loading";
import { useUser } from "@clerk/nextjs"; import { useUser } from "@clerk/nextjs";
export const dynamic = "force-dynamic";
export const revalidate = 0;
export const fetchCache = "force-no-store";
const RoomList = () => { const RoomList = () => {
const { isSignedIn, user } = useUser(); const { isSignedIn, user } = useUser();

View file

@ -25,9 +25,12 @@ import { isAdmin, isVIP, jsonToCsv } from "@/utils/helpers";
import type { PresenceItem } from "@/utils/types"; import type { PresenceItem } from "@/utils/types";
import { trpc } from "@/app/_trpc/client"; import { trpc } from "@/app/_trpc/client";
import Loading from "@/app/_components/Loading"; import Loading from "@/app/_components/Loading";
import { User } from "@clerk/nextjs/dist/types/server";
import { useUser } from "@clerk/nextjs"; import { useUser } from "@clerk/nextjs";
export const dynamic = "force-dynamic";
export const revalidate = 0;
export const fetchCache = "force-no-store";
const VoteUI = () => { const VoteUI = () => {
const params = useParams(); const params = useParams();
const roomId = params?.id as string; const roomId = params?.id as string;

View file

@ -4,12 +4,10 @@ import { GiStarFormation } from "react-icons/gi";
import { isAdmin, isVIP } from "@/utils/helpers"; import { isAdmin, isVIP } from "@/utils/helpers";
import { currentUser } from "@clerk/nextjs"; import { currentUser } from "@clerk/nextjs";
import { Suspense } from "react"; import { Suspense } from "react";
import Loading from "../_components/Loading";
export const runtime = "edge"; export const runtime = "edge";
export const preferredRegion = ["pdx1"]; export const preferredRegion = ["pdx1"];
export const dynamic = "force-dynamic";
export const revalidate = 0;
export const fetchCache = "force-no-store";
export default async function Dashboard() { export default async function Dashboard() {
const user = await currentUser(); const user = await currentUser();
@ -26,7 +24,7 @@ export default async function Dashboard() {
)} )}
</h1> </h1>
<Suspense> <Suspense fallback={<Loading />}>
<RoomList /> <RoomList />
</Suspense> </Suspense>
</div> </div>

View file

@ -1,16 +1,14 @@
import Loading from "@/app/_components/Loading";
import VoteUI from "@/app/_components/VoteUI"; import VoteUI from "@/app/_components/VoteUI";
import { Suspense } from "react"; import { Suspense } from "react";
export const runtime = "edge"; export const runtime = "edge";
export const preferredRegion = ["pdx1"]; export const preferredRegion = ["pdx1"];
export const dynamic = "force-dynamic";
export const revalidate = 0;
export const fetchCache = "force-no-store";
export default async function Room() { export default async function Room() {
return ( return (
<div className="flex flex-col items-center justify-center text-center gap-2"> <div className="flex flex-col items-center justify-center text-center gap-2">
<Suspense> <Suspense fallback={<Loading />}>
<VoteUI /> <VoteUI />
</Suspense> </Suspense>
</div> </div>