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

Product Pages: Support encoded slashes #2163

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Conversation

jarstelfox
Copy link
Contributor

See: vercel/next.js#49646

We have slashes in some variants.

You can see the bug by visiting:

This works around the issue by manually handling the url parsing for this page. We only needed the path segments.

See: vercel/next.js#49646

We have slashes in some variants.

You can see the bug by visiting:

 * https://www.ifixit.com/Parts/iPhone_XR:A1984_US%2FCanada
 * Click Any item type and the page loads fine
 * Refresh and the page 404s

This works around the issue by manually handling the url parsing for this
page. We only needed the path segments
Copy link

vercel bot commented Dec 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-commerce ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2023 10:10pm
react-commerce-prod ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2023 10:10pm

@ghost
Copy link

ghost commented Dec 18, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

Copy link
Contributor

📦 Next.js Bundle Analysis for @ifixit/commerce-frontend

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

* Instead of:
* ['device', 'variant/WithASlash']
*/
const path = context.resolvedUrl.split('?')[0];
Copy link
Member

Choose a reason for hiding this comment

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

I forget which is which, but will this be the right url when the client side is hitting the next.js data api to just get the props?

I'm not entirely sure we'll run into instances where that will happen for this case, but it seems feasible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://nextjs.org/docs/pages/api-reference/functions/get-server-side-props#context-parameter

resolvedUrl

A normalized version of the request URL that strips the _next/data prefix for client transitions and includes original query values.

The docs don't indicate much clarity here, but it seemed safe enough to me.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like the right one!

Copy link
Member

@sterlinghirsh sterlinghirsh left a comment

Choose a reason for hiding this comment

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

CR ⚡ Shame that we have to do this, but it looks ok to me!

@deltuh-vee
Copy link
Contributor

deltuh-vee commented Dec 18, 2023

QA 🎬
No longer getting a 404 when refreshing with an item type selected.

@deltuh-vee deltuh-vee removed the QAing Under QA team review label Dec 19, 2023
@deltuh-vee deltuh-vee merged commit f0534ac into main Dec 19, 2023
15 checks passed
@deltuh-vee deltuh-vee deleted the next-slash-404-workaround branch December 19, 2023 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants