Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

force-dynamic

Steven Tey54509f41f10d
diff --git a/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx b/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx
index 46f0db274c..cc085ba61d 100644
--- a/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx
+++ b/apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx
@@ -9,6 +9,7 @@ import { notFound } from "next/navigation";
import { Suspense } from "react";
import DashboardPasswordForm from "./form";
+export const dynamic = "force-dynamic";
export const runtime = "edge";
export async function generateMetadata({
diff --git a/apps/web/app/password/[linkId]/page.tsx b/apps/web/app/password/[linkId]/page.tsx
index c83cb3bc5e..b403dcce71 100644
--- a/apps/web/app/password/[linkId]/page.tsx
+++ b/apps/web/app/password/[linkId]/page.tsx
@@ -1,4 +1,4 @@
-import { prisma } from "@/lib/prisma";
+import { prismaEdge } from "@/lib/prisma/edge";
import { NewBackground } from "@/ui/shared/new-background";
import { BlurImage, Logo } from "@dub/ui";
import { constructMetadata, isDubDomain } from "@dub/utils";
@@ -6,6 +6,9 @@ import { cookies } from "next/headers";
import { notFound, redirect } from "next/navigation";
import PasswordForm from "./form";
+export const dynamic = "force-dynamic";
+export const runtime = "edge";
+
const title = "Password Required";
const description =
"This link is password protected. Please enter the password to view it.";
@@ -16,7 +19,7 @@ export async function generateMetadata({
}: {
params: { linkId: string };
}) {
- const link = await prisma.link.findUnique({
+ const link = await prismaEdge.link.findUnique({
where: {
id: params.linkId,
},
@@ -51,33 +54,12 @@ export async function generateMetadata({
});
}
-export async function generateStaticParams() {
- const passwordProtectedLinks = await prisma.link.findMany({
- where: {
- password: {
- not: null,
- },
- },
- select: {
- domain: true,
- key: true,
- },
- });
-
- return passwordProtectedLinks.map(({ domain, key }) => ({
- params: {
- domain,
- key: encodeURIComponent(key),
- },
- }));
-}
-
export default async function PasswordProtectedLinkPage({
params,
}: {
params: { linkId: string };
}) {
- const link = await prisma.link.findUnique({
+ const link = await prismaEdge.link.findUnique({
where: {
id: params.linkId,
},