Skip to content

Commit bfd262e

Browse files
committed
refactor: change explore page to dynamic rendering
1 parent f4de29e commit bfd262e

File tree

4 files changed

+25
-31
lines changed

4 files changed

+25
-31
lines changed

src/components/workshops/join-workshop-with-code-form.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function JoinWorkshopWithCodeForm({
2525
<form
2626
className={cn("grid gap-4", className)}
2727
onSubmit={form.handleSubmit(onSubmit)}
28+
autoComplete="off"
2829
{...props}
2930
>
3031
<FormField

src/server/actions/registration.ts

-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export async function registerUserAction(input: RegistrationSchema) {
7272
workshopId: input.workshopId,
7373
})
7474

75-
revalidateTag(`workshops-${input.workshopId}`)
7675
revalidateTag(`workshops-${input.userId}`)
7776

7877
return {
@@ -96,7 +95,6 @@ export async function cancelRegistrationAction(input: RegistrationSchema) {
9695
)
9796
)
9897

99-
revalidateTag(`workshops-${input.workshopId}`)
10098
revalidateTag(`workshops-${input.userId}`)
10199

102100
return {

src/server/actions/workshop.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export async function updateWorkshopAction(
6363

6464
revalidatePath("/explore")
6565
revalidateTag(`workshops-${user.id}`)
66-
revalidateTag(`workshops-${input.id}`)
6766

6867
return {
6968
error: null,
@@ -90,7 +89,6 @@ export async function deleteWorkshopAction(workshopId: string) {
9089
)
9190

9291
revalidatePath("/explore")
93-
revalidateTag(`workshops-${workshopId}`)
9492
revalidateTag(`workshops-${user.id}`)
9593

9694
return {
@@ -119,7 +117,8 @@ export async function startWorkshopAction(workshopId: string) {
119117
.where(
120118
and(eq(workshops.id, workshopId), eq(workshops.organizerId, user.id))
121119
)
122-
revalidateTag(`workshops-${workshopId}`)
120+
121+
revalidateTag(`workshops-${user.id}`)
123122

124123
return {
125124
error: null,
@@ -148,7 +147,7 @@ export async function MarkWorkshopHasCompleted(workshopId: string) {
148147
and(eq(workshops.id, workshopId), eq(workshops.organizerId, user.id))
149148
)
150149

151-
revalidateTag(`workshops-${workshopId}`)
150+
revalidateTag(`workshops-${user.id}`)
152151

153152
return {
154153
error: null,

src/server/data/workshop.ts

+21-25
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,27 @@ export async function getWorkshopSession(workshopId: string) {
2727
}
2828

2929
export async function getWorkshop(workshopId: string) {
30-
return await cache(
31-
async () => {
32-
return db.query.workshops.findFirst({
33-
columns: {
34-
id: true,
35-
organizerId: true,
36-
title: true,
37-
description: true,
38-
duration: true,
39-
accessCode: true,
40-
scheduled: true,
41-
hasStarted: true,
42-
hasCompleted: true,
43-
isPublic: true,
44-
createdAt: true,
45-
},
46-
where: eq(workshops.id, workshopId),
47-
})
48-
},
49-
[`workshop-${workshopId}`],
50-
{
51-
revalidate: 300,
52-
tags: [`workshops-${workshopId}`],
53-
}
54-
)()
30+
noStore()
31+
try {
32+
return db.query.workshops.findFirst({
33+
columns: {
34+
id: true,
35+
organizerId: true,
36+
title: true,
37+
description: true,
38+
duration: true,
39+
accessCode: true,
40+
scheduled: true,
41+
hasStarted: true,
42+
hasCompleted: true,
43+
isPublic: true,
44+
createdAt: true,
45+
},
46+
where: eq(workshops.id, workshopId),
47+
})
48+
} catch (err) {
49+
return null
50+
}
5551
}
5652

5753
export async function getWorkshopMetadata(workshopId: string) {

0 commit comments

Comments
 (0)