vtex / faststore

Digital commerce toolkit for frontend developers
https://faststore.dev
MIT License
186 stars 58 forks source link

Fix: use router replace to change URL and fix fuzzy bugs #2307

Closed lariciamota closed 4 months ago

lariciamota commented 4 months ago

What's the purpose of this pull request?

Fix bugs related to the addition of fuzzy parameters to the URL on PLP (category page and search page). See jira tasks on the references section below.

How it works?

By using the replace function instead of push we are able to update the URL adding the fuzzy parameters to it without triggering the navigation. Thus, it doesn't re-render the page and it doesn't affect the back button to previous page. It happens because the replace doesn't add the new URL as a new entry on the history stack.

How to test it?

Test a category page (example: /office) and test search also. Both pages should have its URL updated to add the fuzzy and operator params, but shouldn't re-render. Also, if you click the browser return button you should go to the previous page (Home, for example, if you were on the Home page and then went to the category page) normally.

Starters Deploy Preview

References

vercel[bot] commented 4 months ago

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

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **faststore-site** | ⬜️ Ignored ([Inspect](https://vercel.com/faststore/faststore-site/GhRR6WbzEsMiuR3VmPjojnDTqwBY)) | [Visit Preview](https://faststore-site-git-fix-fuzzy-re-render-faststore.vercel.app) | | May 9, 2024 3:13pm |
codesandbox-ci[bot] commented 4 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.