Skip to content

Commit

Permalink
feat(graphql-starter)!: upgrade to next.js 15 and react 19
Browse files Browse the repository at this point in the history
  • Loading branch information
yobottehg committed Dec 6, 2024
1 parent 7c9ffeb commit 08ed20b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
11 changes: 4 additions & 7 deletions starters/graphql-starter/app/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { draftMode } from "next/headers"
import { notFound } from "next/navigation"
import { getDraftData } from "next-drupal/draft"
import { Article } from "@/components/drupal/Article"
import { BasicPage } from "@/components/drupal/BasicPage"
import { drupal } from "@/lib/drupal"
Expand Down Expand Up @@ -77,7 +76,7 @@ type NodePageProps = {

export async function generateMetadata(
{ params: { slug } }: NodePageProps,
parent: ResolvingMetadata
_: ResolvingMetadata
): Promise<Metadata> {
let node
try {
Expand Down Expand Up @@ -119,11 +118,9 @@ export async function generateStaticParams(): Promise<NodePageParams[]> {
].map(({ path }) => ({ slug: path.split("/").filter(Boolean) }))
}

export default async function Page({
params: { slug },
searchParams,
}: NodePageProps) {
const isDraftMode = draftMode().isEnabled
export default async function Page({ params: { slug } }: NodePageProps) {
const draftModeStore = await draftMode()
const isDraftMode = draftModeStore.isEnabled

let node
try {
Expand Down
4 changes: 2 additions & 2 deletions starters/graphql-starter/app/api/disable-draft/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { disableDraftMode } from "next-drupal/draft"
import type { NextRequest } from "next/server"

export async function GET(request: NextRequest) {
return disableDraftMode()
export async function GET(_: NextRequest) {
return await disableDraftMode()
}
2 changes: 1 addition & 1 deletion starters/graphql-starter/app/api/draft/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { enableDraftMode } from "next-drupal/draft"
import type { NextRequest } from "next/server"

export async function GET(request: NextRequest): Promise<Response | never> {
return enableDraftMode(request, drupal)
return await enableDraftMode(request, drupal)
}
5 changes: 3 additions & 2 deletions starters/graphql-starter/components/misc/DraftAlert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Suspense } from "react"
import { draftMode } from "next/headers"
import { DraftAlertClient } from "./Client"

export function DraftAlert() {
const isDraftEnabled = draftMode().isEnabled
export async function DraftAlert() {
const draftModeStore = await draftMode()
const isDraftEnabled = draftModeStore.isEnabled

return (
<Suspense fallback={null}>
Expand Down
18 changes: 9 additions & 9 deletions starters/graphql-starter/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "graphql-starter",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"private": true,
"license": "MIT",
"scripts": {
"dev": "next dev",
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"preview": "next build && next start",
Expand All @@ -13,19 +13,19 @@
"format:check": "prettier --check ."
},
"dependencies": {
"next": "^14.2.2",
"next-drupal": "^2.0.0-beta.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "^15.0.4",
"next-drupal": "^2.0.0-beta.1",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.12",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.2",
"eslint-config-next": "^15.0.4",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.3",
Expand Down

0 comments on commit 08ed20b

Please sign in to comment.