-
Notifications
You must be signed in to change notification settings - Fork 187
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
refactor(core): update with-routes to handle redirect logic better #1459
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Skipped Deployments
|
🦋 Changeset detectedLatest commit: b2da4e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
7f73656
to
964b073
Compare
1b466b5
to
ffdf652
Compare
ffdf652
to
c77abca
Compare
case 'BlogPostRedirect': | ||
case 'BrandRedirect': | ||
case 'CategoryRedirect': | ||
case 'PageRedirect': | ||
case 'ProductRedirect': { | ||
// For dynamic redirects, assume an internal redirect and construct the URL from the path | ||
const redirectUrl = new URL(route.redirect.to.path, request.url); | ||
|
||
return NextResponse.redirect(redirectUrl, redirectConfig); |
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.
Hey @willPrattUPL I found a bug in the previous logic as it was rewriting, not redirecting. Can you test y'all redirects from this branch, specifically that 404 that had node
return null
?
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.
I manually tested this with your 404 response, but added a path
node to the "response". It seemed to work on my end but had to push a change to make sure trailing slashes were preserved correctly.
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.
Hey, sorry Chance. We are extremely busy right now but I promise I'll get to this this week @chanceaclark
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.
No worries, if it's good with the team I am going to merge. Feel free to test off main
when you can and let us know if it's still an issue.
3702888
to
407f83b
Compare
33e0773
to
979157b
Compare
Co-authored-by: Chancellor Clark <[email protected]>
979157b
to
b2da4e0
Compare
⚡️🏠 Lighthouse reportLighthouse ran against https://catalyst-latest-e4mnlcnrd-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:
|
I've run this twice, both on the latest changes of my forked repo and our >2months old fork that we have been building off of In both cases I get this: on all redirects /uplift-v2-standing-desk-v2-or-v2-commercial/ All redirects exhibit the exact same behavior as before, except now the 404 is an infinite redirect loop [ Frustratingly, this actually is lending a lot of credence to the theory that the actual root cause is route.node.id ending in "=" Please see link to previous PR comments with my redirect console logging to confirm, but each one ends in "=" ( #1429 (comment) ) |
^This is all likely not correct. Keeping for historical posterity |
Looked into this and seems there were some 301 redirects configured to redirect back onto itself e.g. |
What/Why?
Merging 3rd party code from #1429 (PR was created to run CI)
Testing
See CI