-
Notifications
You must be signed in to change notification settings - Fork 18
Fix/404 categories mobile #43
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
base: master
Are you sure you want to change the base?
Fix/404 categories mobile #43
Conversation
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
|
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
|
No new documentation is required for this fix since it only resolves a 404 error on mobile category navigation. No new functionality or configuration was added. |
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.
Pull request overview
This PR fixes a 404 error that occurred on mobile when navigating between categories in the mega menu. The bug was caused by relative URL path concatenation, where clicking on a new category would append its slug to the previous category's path instead of replacing it.
Changes:
- Fixed URL navigation by adding a leading slash to category slugs when assigning to
window.location.href - Refactored code formatting for improved readability (arrow function syntax, indentation consistency)
- Updated CHANGELOG.md to document the fix
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| react/MegaMenu/components/Submenu.tsx | Fixed category navigation by changing window.location.assign(category.slug) to window.location.href = '/${category.slug}' to prevent URL concatenation; also includes code formatting improvements |
| CHANGELOG.md | Added entry documenting the 404 error fix in the Unreleased section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vsseixaso
left a comment
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.
LGTM!
What problem is this solving?
On mobile, navigating between certain categories sometimes caused a 404 error. The issue happens because the URL concatenates the previous category and subcategory paths with the new category.
Example:
Navigate first to Banheiros > Duchas e Chuveiros.
Then go to Climatizador.
The URL incorrectly becomes: https://www.obramax.com.br/banheiros/duchas-e-chuveiros/climatizacao-e-ventilacao/climatizadores-de-ar instead of the correct path. This results in a 404 page.
WS: https://ombrec1585--lojaobramax.myvtex.com/
How should this be manually tested?
Screenshots or example usage:
Before: https://jam.dev/c/27bb0666-a0ac-44ef-89b6-78e99ba15bac
After: https://www.awesomescreenshot.com/video/45282811?key=71f19bd0438e1949659b9a920819b6e9