-
Notifications
You must be signed in to change notification settings - Fork 179
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
fix: don't rewrite Next.js server actions' requests #1707
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
⚡️🏠 Lighthouse reportLighthouse ran against https://catalyst-latest-pjk5b3na6-bigcommerce-platform.vercel.app 🖥️ DesktopWe ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:
📱 MobileWe ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:
|
node: z.infer<typeof NodeSchema> | null | undefined, | ||
request: NextRequest, | ||
postfix: string, | ||
) => { |
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.
Factored out a standalone piece of logic from withRoutes
below to keep the withRoutes
complexity under the limit. No semantic changes. I kept RawHtmlPage
handling in withRoutes
as a special case that is separate from the rewrite logic.
|
||
if (!request.nextUrl.search && !customerAccessToken && request.method === 'GET') { | ||
postfix = '/static'; | ||
} |
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.
Moved below.
// https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#behavior | ||
if (isServerAction(request)) { | ||
return next(request, event); | ||
} |
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.
The actual fix.
What/Why?
Behind the scenes, Next.js server actions are translated into
POST
requests that get handled by the framework.withRoutes
middleware was intercepting and rewriting these requests as page renders.