Skip to content
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

feat: implement redirect query #1746

Merged
merged 3 commits into from
May 9, 2023
Merged

feat: implement redirect query #1746

merged 3 commits into from
May 9, 2023

Conversation

Git-the-Sanz
Copy link

@Git-the-Sanz Git-the-Sanz commented May 5, 2023

What's the purpose of this pull request?

This PR adds a query to solve redirects when performing a search.
In case of VTEX platform, this is solved by the IS api.

How it works?

When performing a search if a term or facet has a redirect, the value of the redirect field should be an URL; this can later be used to redirect the user to an internal or external URL.

From VTEX admin:
Screenshot 2023-05-04 at 17 51 48

It get solved as:
image

How to test it?

  • Run the @faststore/api package individually.
  • Browse localhost/graphql
  • Run the redirect query with a term that is active in /admin/search/v4/redirects/
  • For storeframework, you can use the term tech

PR related at vtex-sites: vtex-sites/nextjs.store#382
PR related 2.x: #1749

@Git-the-Sanz Git-the-Sanz requested a review from a team as a code owner May 5, 2023 09:45
@Git-the-Sanz Git-the-Sanz requested review from gvc and icazevedo and removed request for a team May 5, 2023 09:45
@vercel
Copy link

vercel bot commented May 5, 2023

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

Name Status Preview Comments Updated (UTC)
faststore-site ❌ Failed (Inspect) May 9, 2023 10:58am

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 5, 2023

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.

Latest deployment of this branch, based on commit 881ee90:

Sandbox Source
Store UI Typescript Configuration

Copy link
Contributor

@icazevedo icazevedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. Did you check schema.org to see if we can rename or rearrange redirect query args in a more agnostic way?

Copy link
Contributor

@icazevedo icazevedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'm only now realizing the return type of the query is String. This doesn't scale well, as it prevents any other additions in the future. I think we should change it to an object that can be of type Thing. It has an url field and, in the future, I see us using the identifier field to specify the status code of the redirect. I can also evolve into any other parent type, as it would be a very generic one for now.

@beatrizmaselli beatrizmaselli merged commit d9b0ace into 1.x May 9, 2023
@beatrizmaselli beatrizmaselli deleted the feat/redirect-query branch May 9, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants