Skip to content

fix: correctly match params in edge runtime #1896

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

Merged
merged 8 commits into from
Jan 26, 2023
Merged

Conversation

ascorbic
Copy link
Contributor

Summary

Next.js was not populating the params from dynamic edge runtime pages. This PR fixes that by populating the x-matched-path header, which along with setting minimal mode, makes Next.js parse the params as if we're on a certain triangle-shaped host. This includes correctly populating the params.

Fixes #1890

Test plan

  1. Visit /edge/123?hello=world in the default demo
  2. Check that query is { id: '123', hello: 'world' } and params is { id: '123' }

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

pão em forma de capivara

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@ascorbic ascorbic requested a review from a team January 20, 2023 17:33
@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/63d2960b3c022500088550ce
😎 Deploy Preview https://deploy-preview-1896--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/63d2960b3a004e0008a12082
😎 Deploy Preview https://deploy-preview-1896--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the type: bug code to address defects in shipped code label Jan 20, 2023
@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/63d2960bbe06ca00085410bb
😎 Deploy Preview https://deploy-preview-1896--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/63d2960b6715f70008898027
😎 Deploy Preview https://deploy-preview-1896--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/63d2960baae89c0008add918
😎 Deploy Preview https://deploy-preview-1896--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/63d2960bb1a136000836c07f
😎 Deploy Preview https://deploy-preview-1896--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/63d2960bbd1eba0008997820
😎 Deploy Preview https://deploy-preview-1896--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/63d2960c0cf129000b3b089a
😎 Deploy Preview https://deploy-preview-1896--next-plugin-canary.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit 0b9dbb3
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/63d2960bc6a0fc0009df9b5a
😎 Deploy Preview https://deploy-preview-1896--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ascorbic ascorbic marked this pull request as draft January 20, 2023 17:48
@netlify
Copy link

netlify bot commented Jan 25, 2023

Deploy Preview for graceful-sfogliatella-8d42f0 failed.

Name Link
🔨 Latest commit b29c636
🔍 Latest deploy log https://app.netlify.com/sites/graceful-sfogliatella-8d42f0/deploys/63d2580340a790000863ea55

@ascorbic ascorbic marked this pull request as ready for review January 26, 2023 11:14
Copy link
Contributor

@orinokai orinokai left a comment

Choose a reason for hiding this comment

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

Nice one, looks/works great 🚢

Copy link

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

Thanks for adding the comments @ascorbic! I tested this out per the test steps and works like a charm! 🚢

image

@kodiakhq kodiakhq bot merged commit 75c0535 into main Jan 26, 2023
@kodiakhq kodiakhq bot deleted the mk/edge-match-path branch January 26, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: edge rendered dynamic routes do not correctly parse slugs into params
3 participants