Skip to content
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

chore: Update example to use the correct param #65591

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

brunorodmoreira
Copy link

Fix the instructions in https://nextjs.org/docs/messages/middleware-upgrade-guide#no-more-page-match-data. The current pattern.exec doesn't contain the correct parameter type and also there's no import of URLPattern.

@brunorodmoreira brunorodmoreira requested review from a team as code owners May 9, 2024 23:07
@brunorodmoreira brunorodmoreira requested review from molebox and StephDietz and removed request for a team May 9, 2024 23:07
@ijjk ijjk added the Documentation Related to Next.js' official documentation. label May 9, 2024
@ijjk
Copy link
Member

ijjk commented May 9, 2024

Allow CI Workflow Run

  • approve CI run for commit: 89f0dc4

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@@ -345,32 +345,28 @@ export function middleware(request: NextRequest, event: NextFetchEvent) {
#### After

```ts filename="middleware.ts"
import { NextResponse } from 'next/server'
import { NextResponse, URLPattern } from 'next/server'
import type { NextRequest } from 'next/server'

const PATTERNS = [
[
new URLPattern({ pathname: '/:locale/:slug' }),
({ pathname }) => pathname.groups,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a type to pathname here too so it's not an any type!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Related to Next.js' official documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants