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

StorefrontRedirect() fails with capitalized paths #908

Closed
duncan-fairley opened this issue May 18, 2023 · 4 comments · Fixed by #1941
Closed

StorefrontRedirect() fails with capitalized paths #908

duncan-fairley opened this issue May 18, 2023 · 4 comments · Fixed by #1941
Labels
Blocked Progress on this issue is blocked by something outside of our control Storefront API Issues related to https://shopify.dev/docs/api/storefront

Comments

@duncan-fairley
Copy link
Contributor

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2023.4.0

What version of Remix are you using?

1.15

Steps to Reproduce

  1. Set up a redirect in the Shopify admin containing a capitalized character (for example: /findHIN)
  2. Observe that it fails to redirect as intended through a Hydrogen storefront
  3. Change the path to all lowercase (for example: /findhin)
  4. Observe that the redirect works as intended

Expected Behavior

Redirect would be case-insensitive or least resolve capitalized result matching what was entered into the admin

Actual Behavior

If you run the query that backs storefrontRedirect() you will see that any capitalized characters result in no results returned:

  query redirects{
    urlRedirects(first: 1, query: "path:/findHIN") {
      edges {
        node {
          target
        }
      }
    }
  }
{
  "data": {
    "urlRedirects": {
      "edges": []
    }
  }
}

Interestingly, the following queries both return the intended result:

  query redirects{
    urlRedirects(first: 1, query: "/findHIN") {
      edges {
        node {
          target
        }
      }
    }
  }
  query redirects{
    urlRedirects(first: 1, query: "path:/findhin") {
      edges {
        node {
          target
        }
      }
    }
  }
@duncan-fairley
Copy link
Contributor Author

As a temporary measure, I've moved the storefrontRedirect() function into each of our storefronts so we could force the queried path to all lowercase:

    const { urlRedirects } = await storefront.query<{
      urlRedirects: UrlRedirectConnection
    }>(REDIRECT_QUERY, {
      variables: { query: redirectFrom.toLowerCase() },
    })

We're validating that this wont cause unforeseen issues with other redirects

@frehner
Copy link
Contributor

frehner commented May 18, 2023

Well that's a fun one. Thanks for the detailed info 👍

I'll try to raise this with the Storefront API team and see what they think

@frehner frehner added Blocked Progress on this issue is blocked by something outside of our control Storefront API Issues related to https://shopify.dev/docs/api/storefront labels May 22, 2023
@frehner
Copy link
Contributor

frehner commented May 22, 2023

Haven't heard from them yet, I'll send a followup message

@jakejgk
Copy link

jakejgk commented Apr 3, 2024

Has this been solved? Having issues with storefrontRedirect due to case issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked Progress on this issue is blocked by something outside of our control Storefront API Issues related to https://shopify.dev/docs/api/storefront
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants