vtex / faststore

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

Fix URL update to prevent page reloads #2334

Closed beatrizmaselli closed 1 month ago

beatrizmaselli commented 1 month ago

What's the purpose of this pull request?

Fix the blink for Dunnes project when the param is added at the URL:

https://github.com/vtex/faststore/assets/67066494/65af813c-d604-4594-b04c-cd61340ea76a

How it works?

Added window.history.replaceState({}, '', newUrl) to stop the page from reloading unnecessarily.

How to test it?

Core Before:

https://github.com/vtex/faststore/assets/67066494/571673df-e4bc-4da4-9874-939fe13ec492

Core After:

https://github.com/vtex/faststore/assets/67066494/56ee0b93-1ba3-4a93-8fab-6715745ee18c

Starters Deploy Preview

Beta package: https://partnerintegrationbra-clvfdw8vd00danzcdwpy08ig3-rd740v8hj.b.vtex.app/ Enter a category like clothing: https://partnerintegrationbra-clvfdw8vd00danzcdwpy08ig3-rd740v8hj.b.vtex.app/clothing

References

No specific reference here :)

vercel[bot] commented 1 month 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/c3nXTErvRQnMZtAc6v9Fvi7P53Ce)) | [Visit Preview](https://faststore-site-git-fix-reloading-search-state-faststore.vercel.app) | | Jun 4, 2024 1:38pm |
codesandbox-ci[bot] commented 1 month 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.