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

Query value seems to be ignored #108

Open
hapoza opened this issue Feb 6, 2019 · 6 comments
Open

Query value seems to be ignored #108

hapoza opened this issue Feb 6, 2019 · 6 comments
Assignees
Labels

Comments

@hapoza
Copy link

hapoza commented Feb 6, 2019

Expected Behavior

The app should respect the options provided to StoreFront, like "Query" and "Other Query Strings".

Current Behavior

If I go to StoreFront and type a valid query on the input, when I access the URL that I created a configuration for, it does not load the results with the query that was filled on storefront.
The prop does show up on ReactDevTools when inspecting the SearchResultQueryLoader component, inside props.querySchema as queryField and restField.

Doing the same exact query on the API works, example /api/catalog_system/pub/products/search/whatever?map=ft&fq=productClusterIds:137

Possible Solution

N/A

Steps to Reproduce (for bugs)

  1. Create a collection on CMS and get it's ID
  2. On StoreFront, access a search term that would otherwise be empty, like "carnaval"
  3. Create a configuration, choose "Apply configuration for:" "This URL"
  4. On either "Query" or "Other Query Strings" fields, input a valid filter that works on the API, like fq=productClusterIds:{{cluster id}}
  5. Save and access that same search page on the dreamstore frontend, it will still show up as an empty search.

Context

I'm trying to create an URL that loads an specific collection, like it is possible to do on CMS, by creating the URL and attributing a product cluster to it

Your Environment

  • Version used: 1.x
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Chrome 71
  • Operating System and version (desktop or mobile): macOS High Sierra
  • Link to your project: N/A
@rerissondaniel rerissondaniel self-assigned this Feb 6, 2019
@hapoza
Copy link
Author

hapoza commented Feb 6, 2019

I figured it out, it's because the search-result app uses the Context from vtex.store if that's available. I created a new page without the context, then the StoreFront settings are being passed as props to the GraphQL query component and it's working as intended.

@hapoza hapoza closed this as completed Feb 6, 2019
@rerissondaniel
Copy link
Contributor

Hi @hapoza, thanks for opening the issue. In fact these schema properties should only be shown in storefront if the app is outside the context you mentioned.

@hapoza
Copy link
Author

hapoza commented Feb 7, 2019

@rerissondaniel Then it's a different bug, they are being shown when the Context is present. Check this store, it is a vanilla implementation of dreamstore, no code customization was done: https://avanti.myvtex.com/admin/cms/storefront

It does show the inputs for Query, Map and others when accessing a page that's within SearchContextProvider.

Should I create a new issue?

@rerissondaniel
Copy link
Contributor

rerissondaniel commented Feb 7, 2019

@hapoza Yes, but it causes the misunderstanding that made you open this issue. I'm looking into it, but I don't know if that will be possible to solve right now, because the props that are coming to getSchema are different from those that comes to the render method of the component. Since the problem you had was caused by this bug I'll just reopen this

@fabiofeichtinger
Copy link

We're also facing this problem with the querystrings.

@hapoza
Copy link
Author

hapoza commented Jun 18, 2019

This issue is referring to dreamstore themes (that used version 1.x of this app). We are migrating our legacy dreamstores to store-theme, but the "issue" still happens on the latest version (if the page has a SearchContext, storefront configs are not used). If we create a template that doesn't have the context, it works as intended.
@rerissondaniel IMHO this issue can be closed, since there is a way of using search-result as intended, but I think the docs should have something explaining this use case of custom query pages (examples are collection or seller pages). I'll leave the decision to you if this should be closed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants