vtex / faststore

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

fix: Pass Through PLP URL Params #2355

Closed batzlerg closed 1 week ago

batzlerg commented 1 month ago

What's the purpose of this pull request?

URL params are stripped out on inbound PLP links when the app rebuilds the URL from state. This is undesirable for end users who need to add params to their links - e.g. referral or UTM tracking codes.

How it works?

Any params that are not included in the state allow list are grouped into a passThrough field in the state, and added back when the URL is rebuilt.

How to test it?

  1. Visit a PLP link with a URL param: /my-cool-category?foo=bar
  2. Validate that the additional param is preserved after URL state updates

I'm happy to adjust naming or implementation, this set of changes was the result of a spike into preserving UTM params on inbound links.

vercel[bot] commented 1 month ago

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

Name Status Preview Comments Updated (UTC)
faststore-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2024 8:56pm
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.