mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This fixes some scenarios where executing a server action after navigation can cause the action to behave incorrectly (double submitting, not resolving). There are two separate issues: - `canonicalUrl` and `pendingNavigatePath` were not constructed using the same function (`createHrefFromUrl`) so in certain situations they'd be comparing different values - a fulfilled inFlightServerAction should not be invoked again Closes NEXT-1655 Closes NEXT-1654 Fixes #55845 Fixes #55814 Fixes #55805
10 lines
287 B
JavaScript
10 lines
287 B
JavaScript
import { NextResponse } from 'next/server'
|
|
|
|
export function middleware(request) {
|
|
if (request.nextUrl.pathname.startsWith('/middleware-redirect')) {
|
|
return NextResponse.redirect(new URL('/action-after-redirect', request.url))
|
|
}
|
|
}
|
|
|
|
export const matcher = ['/middleware-redirect']
|