Skip to content

Commit 84bbb29

Browse files
committed
upgrade nextjs, clerk
1 parent ddd5de7 commit 84bbb29

File tree

12 files changed

+653
-193
lines changed

12 files changed

+653
-193
lines changed

package-lock.json

Lines changed: 589 additions & 148 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dependencies": {
4444
"@aws-sdk/client-s3": "^3.787.0",
4545
"@aws-sdk/s3-request-presigner": "^3.787.0",
46-
"@clerk/nextjs": "^6.0.0",
46+
"@clerk/nextjs": "^6.21.0",
4747
"@hookform/resolvers": "^2.9.11",
4848
"@prisma/client": "^5.10.2",
4949
"@radix-ui/react-accordion": "^1.2.11",
@@ -115,7 +115,7 @@
115115
"luxon": "^3.2.1",
116116
"mapbox-gl": "^3.11.0",
117117
"nanoid": "^4.0.0",
118-
"next": "^14.1.1",
118+
"next": "^15.3.3",
119119
"next-seo": "^5.15.0",
120120
"openai": "^4.82.0",
121121
"partysocket": "0.0.25",

public/favicon-32x32.png

1.94 KB
Loading

src/app/api/services/slack/notify/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getCommunityFromSubdomain } from "src/utils/getCommunityFromSubdomain";
99

1010
export async function POST(req: NextRequest) {
1111
console.log("[api] services/slack/notify");
12-
const headersList = headers();
12+
const headersList = await headers();
1313
const body = await req.json();
1414
const { eventId, type } = pick(body, ["eventId", "type"]);
1515
const host = headersList.get("host") ?? "kernel";

src/app/api/upsert/convo/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ const sendEmailsAsync = async (
172172

173173
// Queue Slack notification instead of sending directly
174174
try {
175-
const headersList = headers();
175+
const headersList = await headers();
176176
const host = headersList.get("host") ?? "kernel";
177177

178178
// Import the queue function to avoid circular dependencies

src/app/blog/[slug]/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import Link from "next/link";
88
import BlogBackground from "src/components/BlogBackground";
99

1010
interface Props {
11-
params: {
11+
params: Promise<{
1212
slug: string;
13-
};
13+
}>;
1414
}
1515

16-
export default function BlogPost({ params }: Props) {
17-
const ember = getEmberBySlug(params.slug);
16+
export default async function BlogPost({ params }: Props) {
17+
const { slug } = await params;
18+
const ember = getEmberBySlug(slug);
1819

1920
if (!ember) {
2021
notFound();

src/app/collection/[collectionId]/page.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
"use client";
22

3+
import React from "react";
34
import Main from "src/layouts/Main";
45
import useCollection from "src/hooks/useCollection";
56
import { Events } from "src/components/Events";
67
import TitleLoadingState from "src/components/LoadingState/Title";
78

8-
const Post = ({ params }: { params: { collectionId: string } }) => {
9-
const collectionId = params.collectionId;
9+
const Post = ({ params }: { params: Promise<{ collectionId: string }> }) => {
10+
const [collectionId, setCollectionId] = React.useState<string | null>(null);
11+
12+
React.useEffect(() => {
13+
params.then(({ collectionId }) => {
14+
setCollectionId(collectionId);
15+
});
16+
}, [params]);
1017
const {
1118
isLoading: isCollectionLoading,
1219
isError,
1320
data: collection,
14-
} = useCollection({ collectionId });
21+
} = useCollection({ collectionId: collectionId || undefined });
1522

1623
return (
1724
<Main>

src/app/community/[communitySubdomain]/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ import type { Metadata } from "next";
55
import CommunityDetails from "../../../components/Community/CommunityDetails";
66

77
type Props = {
8-
params: { communitySubdomain: string };
8+
params: Promise<{ communitySubdomain: string }>;
99
};
1010

1111
export const revalidate = 3600; // revalidate every hour
1212

1313
export async function generateMetadata({ params }: Props): Promise<Metadata> {
14+
const { communitySubdomain } = await params;
1415
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "https://www.convo.cafe";
1516

1617
try {
1718
// Fetch the community data
1819
const community = await prisma.community.findUnique({
19-
where: { subdomain: params.communitySubdomain },
20+
where: { subdomain: communitySubdomain },
2021
include: {
2122
slack: true,
2223
events: {
@@ -41,7 +42,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
4142
openGraph: {
4243
title: metaTitle,
4344
description: metaDescription,
44-
url: `${baseUrl}/community/${params.communitySubdomain}`,
45+
url: `${baseUrl}/community/${communitySubdomain}`,
4546
siteName: "Convo Cafe",
4647
locale: "en_US",
4748
type: "profile",
@@ -58,8 +59,9 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
5859
}
5960

6061
async function CommunityPage({ params }: Props) {
62+
const { communitySubdomain } = await params;
6163
const community = await prisma.community.findUnique({
62-
where: { subdomain: params.communitySubdomain },
64+
where: { subdomain: communitySubdomain },
6365
include: {
6466
slack: true,
6567
events: {

src/app/edit/[eventHash]/page.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@ import { useRouter } from "next/navigation";
1515
import type { ClientEventInput } from "src/types";
1616
import { useBetaMode } from "src/hooks/useBetaMode";
1717

18-
const Edit = ({ params }: { params: { eventHash: string } }) => {
18+
const Edit = ({ params }: { params: Promise<{ eventHash: string }> }) => {
1919
const { push } = useRouter();
20-
const { eventHash } = params;
20+
const [eventHash, setEventHash] = useState<string | null>(null);
21+
22+
useEffect(() => {
23+
params.then(({ eventHash }) => {
24+
setEventHash(eventHash);
25+
});
26+
}, [params]);
2127
// Set dontFetch explicitly to true for edit pages to prevent refetching and form resets
2228
// Added staleTime: Infinity in useEvent hook to prevent refetching when tab regains focus
2329
const { data, isLoading: isEventLoading } = useEvent({
24-
hash: eventHash,
30+
hash: eventHash || "",
2531
dontFetch: true, // Ensure we don't poll for updates on edit pages
2632
});
2733
const { deleteEvent, isDeleting } = useDeleteEvent();
@@ -57,7 +63,7 @@ const Edit = ({ params }: { params: { eventHash: string } }) => {
5763
// Also ensure other dependencies are correct
5864
}, [user, data, isBetaMode, setInvalidRequest]);
5965

60-
if (isEventLoading || !user) {
66+
if (isEventLoading || !user || !eventHash) {
6167
return (
6268
<Main>
6369
<div className="flex flex-col items-center justify-center">
@@ -89,6 +95,7 @@ const Edit = ({ params }: { params: { eventHash: string } }) => {
8995
}
9096

9197
const handleDelete = async () => {
98+
if (!eventHash) return;
9299
const success = await deleteEvent(eventHash);
93100
if (success) {
94101
// Redirect to home page after successful deletion

src/app/providers.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { UserProvider } from "src/context/UserContext";
55
import { ClerkProvider } from "@clerk/nextjs";
66
import { TooltipProvider } from "src/components/ui/tooltip";
77
import { RsvpIntentionProvider } from "src/context/RsvpIntentionContext";
8-
import { createContext, useContext } from "react";
8+
import { createContext } from "react";
99
import { CommunityProvider } from "src/context/CommunityContext";
1010
import { Toaster } from "react-hot-toast";
1111
import { DataLossBanner } from "src/components/DataLossBanner";
@@ -24,22 +24,22 @@ export default function Providers({
2424
isBetaMode?: boolean;
2525
}>) {
2626
return (
27-
<ClerkProvider
28-
publishableKey={process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY!}
29-
signInUrl="/signin"
30-
signUpUrl="/signup"
31-
signInFallbackRedirectUrl="/"
32-
signUpFallbackRedirectUrl="/"
33-
afterSignOutUrl="/"
34-
dynamic
35-
appearance={{
36-
elements: {
37-
formButtonPrimary: "bg-primary hover:bg-primary/90",
38-
card: "shadow-lg",
39-
},
40-
}}
41-
>
42-
<BetaModeContext.Provider value={isBetaMode || false}>
27+
<BetaModeContext.Provider value={isBetaMode || false}>
28+
<ClerkProvider
29+
publishableKey={process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY!}
30+
signInUrl="/signin"
31+
signUpUrl="/signup"
32+
signInFallbackRedirectUrl="/"
33+
signUpFallbackRedirectUrl="/"
34+
afterSignOutUrl="/"
35+
dynamic
36+
appearance={{
37+
elements: {
38+
formButtonPrimary: "bg-primary hover:bg-primary/90",
39+
card: "shadow-lg",
40+
},
41+
}}
42+
>
4343
<QueryClientProvider client={queryClient}>
4444
<UserProvider>
4545
<CommunityProvider>
@@ -75,7 +75,7 @@ export default function Providers({
7575
</CommunityProvider>
7676
</UserProvider>
7777
</QueryClientProvider>
78-
</BetaModeContext.Provider>
79-
</ClerkProvider>
78+
</ClerkProvider>
79+
</BetaModeContext.Provider>
8080
);
8181
}

0 commit comments

Comments
 (0)