vtex / faststore

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

fix: Intelligent Search term redirects when available #2331

Closed lucasfp13 closed 1 month ago

lucasfp13 commented 1 month ago

What's the purpose of this pull request?

This PR intends to fix the behavior when there is an Intelligent Search term redirect registered on VTEX Admin, redirecting the user on the client-side.

FastStore Experience team discussed about solving this on the server-side, but we are not going to handle the drawbacks of generate the search page (pages/s.tsx) as SSR using getServerSideProps right now. By performing this query (and the other function calls) as SSR page, each time user visits that page the potential extra costs needs to be validated later.

How it works?

When performing a search, if the term has a redirect registered on VTEX Admin the value of the redirect field should be an URL, used to redirect the user to an internal or external URL.

Check https://github.com/vtex/faststore/pull/1749 for more information.

How to test it?

This happens because there is already a redirect registered for the storeframework account.

Starters Deploy Preview

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 Jun 6, 2024 1:17pm
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.

lucasfp13 commented 1 month ago

Good job, @lucasfp13 ! The UX is way better, and keeping SSG :)

I noticed a little layout shift while redirecting, but it is not something to concern, that's a very specific case. screen-capture (1).webm

Yeah, I noticed the layout shift too 😞 It's something that I can think a solution for this in this PR, but if it takes longer I'll reassign this to another task