Skip to content

Commit da65712

Browse files
committed
chore(release): bump starters to 2.0.0-rc.0
1 parent aadba14 commit da65712

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { draftMode } from "next/headers"
22
import { notFound } from "next/navigation"
3-
import { getDraftData } from "next-drupal/draft"
43
import { Article } from "@/components/drupal/Article"
54
import { BasicPage } from "@/components/drupal/BasicPage"
65
import { drupal } from "@/lib/drupal"
@@ -77,7 +76,7 @@ type NodePageProps = {
7776

7877
export async function generateMetadata(
7978
{ params: { slug } }: NodePageProps,
80-
parent: ResolvingMetadata
79+
_: ResolvingMetadata
8180
): Promise<Metadata> {
8281
let node
8382
try {
@@ -119,11 +118,9 @@ export async function generateStaticParams(): Promise<NodePageParams[]> {
119118
].map(({ path }) => ({ slug: path.split("/").filter(Boolean) }))
120119
}
121120

122-
export default async function Page({
123-
params: { slug },
124-
searchParams,
125-
}: NodePageProps) {
126-
const isDraftMode = draftMode().isEnabled
121+
export default async function Page({ params: { slug } }: NodePageProps) {
122+
const draft = await draftMode()
123+
const isDraftMode = draft.isEnabled
127124

128125
let node
129126
try {

app/api/disable-draft/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { disableDraftMode } from "next-drupal/draft"
22
import type { NextRequest } from "next/server"
33

4-
export async function GET(request: NextRequest) {
5-
return disableDraftMode()
4+
export async function GET(_: NextRequest) {
5+
return await disableDraftMode()
66
}

app/api/draft/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { enableDraftMode } from "next-drupal/draft"
33
import type { NextRequest } from "next/server"
44

55
export async function GET(request: NextRequest): Promise<Response | never> {
6-
return enableDraftMode(request, drupal)
6+
return await enableDraftMode(request, drupal)
77
}

app/api/revalidate/route.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
import { revalidatePath } from "next/cache"
1+
import { revalidatePath, revalidateTag } from "next/cache"
22
import type { NextRequest } from "next/server"
33

44
async function handler(request: NextRequest) {
55
const searchParams = request.nextUrl.searchParams
66
const path = searchParams.get("path")
7+
const tags = searchParams.get("tags")
78
const secret = searchParams.get("secret")
89

910
// Validate secret.
1011
if (secret !== process.env.DRUPAL_REVALIDATE_SECRET) {
1112
return new Response("Invalid secret.", { status: 401 })
1213
}
1314

14-
// Validate path.
15-
if (!path) {
16-
return new Response("Invalid path.", { status: 400 })
15+
// Either tags or path must be provided.
16+
if (!path && !tags) {
17+
return new Response("Missing path or tags.", { status: 400 })
1718
}
1819

1920
try {
20-
revalidatePath(path)
21+
path && revalidatePath(path)
22+
tags?.split(",").forEach((tag) => revalidateTag(tag))
2123

2224
return new Response("Revalidated.")
2325
} catch (error) {

components/misc/DraftAlert/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { Suspense } from "react"
22
import { draftMode } from "next/headers"
33
import { DraftAlertClient } from "./Client"
44

5-
export function DraftAlert() {
6-
const isDraftEnabled = draftMode().isEnabled
5+
export async function DraftAlert() {
6+
const draft = await draftMode()
7+
const isDraftEnabled = draft.isEnabled
78

89
return (
910
<Suspense fallback={null}>

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "graphql-starter",
3-
"version": "2.0.0-beta.0",
3+
"version": "2.0.0-rc.0",
44
"private": true,
55
"license": "MIT",
66
"scripts": {
7-
"dev": "next dev",
7+
"dev": "next dev --turbopack",
88
"build": "next build",
99
"start": "next start",
1010
"preview": "next build && next start",
@@ -13,22 +13,22 @@
1313
"format:check": "prettier --check ."
1414
},
1515
"dependencies": {
16-
"next": "^14.2.2",
17-
"next-drupal": "^2.0.0-beta.0",
18-
"react": "^18.2.0",
19-
"react-dom": "^18.2.0"
16+
"next": "^15.1.2",
17+
"next-drupal": "^2.0.0-beta.1",
18+
"react": "^19.0.0",
19+
"react-dom": "^19.0.0"
2020
},
2121
"devDependencies": {
2222
"@tailwindcss/typography": "^0.5.12",
2323
"@types/node": "^20.12.7",
24-
"@types/react": "^18.2.79",
25-
"@types/react-dom": "^18.2.25",
24+
"@types/react": "^19.0.0",
25+
"@types/react-dom": "^19.0.0",
2626
"autoprefixer": "^10.4.19",
2727
"eslint": "^8.57.0",
28-
"eslint-config-next": "^14.2.2",
28+
"eslint-config-next": "^15.0.4",
2929
"postcss": "^8.4.38",
3030
"prettier": "^3.2.5",
3131
"tailwindcss": "^3.4.3",
3232
"typescript": "^5.4.5"
3333
}
34-
}
34+
}

0 commit comments

Comments
 (0)