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

viewDerivatives not understanding gql query variables #37

Open
julpod opened this issue Jun 23, 2020 · 0 comments
Open

viewDerivatives not understanding gql query variables #37

julpod opened this issue Jun 23, 2020 · 0 comments

Comments

@julpod
Copy link

julpod commented Jun 23, 2020

Hi all,

First of all thanks for this really powerful module!!

I believe there is a bug on how the viewDerivative process the ViewsFilterInput.

Sample gql:

query ($entityId: String!, $entityLanguage: LanguageId!, $langcode: String!) {
  one: nodeById(id: $entityId, language: $entityLanguage) {
    id: entityId
    title: entityLabel
    ... on NodePage {
      fieldContent {
        component: entity {
          ... on ParagraphCatalog {
            fieldView {
              view: viewDerivative(filter: {langcode: "en"}) {
                ... on PostsGraphql1ViewResult {
                  results {
                    ... on NodePost {
                      entityId
                      entityLabel
                      langcode {
                        value
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  two: nodeById(id: $entityId, language: $entityLanguage) {
    id: entityId
    title: entityLabel
    ... on NodePage {
      fieldContent {
        component: entity {
          ... on ParagraphCatalog {
            fieldView {
              view: viewDerivative(filter: {langcode: $langcode}) {
                ... on PostsGraphql1ViewResult {
                  results {
                    ... on NodePost {
                      entityId
                      entityLabel
                      langcode {
                        value
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  three: postsGraphql1View(filter: {langcode: $langcode}) {
    results {
      langcode {
        value
      }
    }
  }
}

and here is the view:

Screen Shot 2020-06-23 at 19 08 39

  • query one works just fine when using view: viewDerivative(filter: {langcode: "en"}) { (notice the hardcoded string for the language code).
  • query two does not work when using view: viewDerivative(filter: {langcode: $langcode}) { (notice that here I'm using the variable.
  • query three also works fine when using three: postsGraphql1View(filter: {langcode: $langcode}) { (here I'm using a variable but using the Query directly.

I already tried using contextualFilter instead of filter and the same behaviour happens.

Is there any workaround for this kind of scenario?

Thanks in advance!

@julpod julpod changed the title viewDerivatives not understanding variables viewDerivatives not understanding gql query variables Jun 23, 2020
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

No branches or pull requests

1 participant