-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to nextjs 15 #249
base: main
Are you sure you want to change the base?
Upgrade to nextjs 15 #249
Changes from 2 commits
bfaa7f9
e41a05f
373581d
b874da6
77dc348
69c83b2
5f384a9
8971835
33ad55f
04fee0a
832e991
f63cc7c
86cf7ac
6d15d5e
2799794
572e129
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
"use client"; | ||
|
||
import { useCallback } from "react"; | ||
import { useCallback, use } from "react"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Cannot use the The Apply this diff to fix the issue: - import { useCallback, use } from "react";
+ import { useCallback } from "react";
...
- export default function LicensePage(props: {
- searchParams: Promise<{ "license-key"?: string }>;
+ export default function LicensePage(props: {
+ searchParams: { "license-key"?: string };
}) {
...
- const searchParams = use(props.searchParams);
+ const { searchParams } = props; Also applies to: 15-16, 18-18 |
||
import { type SubmitHandler, useForm } from "react-hook-form"; | ||
import { Button } from "@/components/Button"; | ||
import { Input } from "@/components/Input"; | ||
|
@@ -12,11 +12,10 @@ import { useUser } from "@/hooks/useUser"; | |
|
||
type Inputs = { licenseKey: string }; | ||
|
||
export default function LicensePage({ | ||
searchParams, | ||
}: { | ||
searchParams: { "license-key"?: string }; | ||
export default function LicensePage(props: { | ||
searchParams: Promise<{ "license-key"?: string }>; | ||
}) { | ||
const searchParams = use(props.searchParams); | ||
const licenseKey = searchParams["license-key"]; | ||
|
||
const { data } = useUser(); | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -15,11 +15,13 @@ import { getMessage } from "@/utils/gmail/message"; | |||||||||||
|
||||||||||||
export const dynamic = "force-dynamic"; | ||||||||||||
|
||||||||||||
export default async function SimplePage({ | ||||||||||||
searchParams: { pageToken, type = "IMPORTANT" }, | ||||||||||||
}: { | ||||||||||||
searchParams: { pageToken?: string; type?: string }; | ||||||||||||
export default async function SimplePage(props: { | ||||||||||||
searchParams: Promise<{ pageToken?: string; type?: string }>; | ||||||||||||
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect handling of In Next.js, Apply this diff to correct the function signature and usage: -export default async function SimplePage(props: {
- searchParams: Promise<{ pageToken?: string; type?: string }>;
-}) {
- const searchParams = await props.searchParams;
+export default async function SimplePage({ searchParams }: {
+ searchParams: { pageToken?: string; type?: string };
+}) { 📝 Committable suggestion
Suggested change
|
||||||||||||
}) { | ||||||||||||
const searchParams = await props.searchParams; | ||||||||||||
|
||||||||||||
const { pageToken, type = "IMPORTANT" } = searchParams; | ||||||||||||
|
||||||||||||
const session = await auth(); | ||||||||||||
const email = session?.user.email; | ||||||||||||
if (!email) throw new Error("Not authenticated"); | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1 @@ | ||
export { GET, POST } from "./auth"; | ||
// export const runtime = "edge" // optional | ||
|
||
// This code was used in the past to reask for consent when signing in with Google. | ||
// This doesn't happen often, but I'm keeping it here for now just in case we decide to put it back. | ||
// This code worked with Next Auth v4. We've since moved to v5. | ||
|
||
// import NextAuth from "next-auth"; | ||
// import { authOptions, getAuthOptions } from "@/utils/auth"; | ||
|
||
// export const dynamic = "force-dynamic"; | ||
|
||
// // https://next-auth.js.org/configuration/initialization#advanced-initialization | ||
// async function handler( | ||
// request: Request, | ||
// context: { params?: { nextauth?: string[] } } | ||
// ) { | ||
// let authOpts = authOptions; | ||
|
||
// if ( | ||
// request.method === "POST" && | ||
// context.params?.nextauth?.[0] === "signin" && | ||
// context.params.nextauth[1] === "google" | ||
// ) { | ||
// const clonedRequest = request.clone(); | ||
// const formData = await clonedRequest.formData(); | ||
// const requestConsent = formData.get("consent") === "true"; | ||
|
||
// authOpts = getAuthOptions({ consent: requestConsent }); | ||
// } | ||
|
||
// // can remove `as any` once this is fixed: https://github.com/nextauthjs/next-auth/issues/8120 | ||
// return await NextAuth(request as any, context as any, authOpts); | ||
// } | ||
|
||
// export { handler as GET, handler as POST }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Add error handling for
use
hook in the following files:apps/web/app/(app)/automation/group/[groupId]/page.tsx
apps/web/app/(app)/automation/rule/[ruleId]/examples/page.tsx
apps/web/app/(app)/automation/group/[groupId]/examples/page.tsx
🔗 Analysis chain
Consider adding error handling for
use
hook.The
use
hook is correctly applied to unwrap the Promise-basedparams
. However, consider adding error handling to manage potential Promise rejection scenarios. This could be achieved by wrapping the component in an error boundary or using a try-catch block.To ensure this change is consistent across the codebase, let's check for similar usage:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1164