drupal-graphql / graphql-views

11 stars 18 forks source link

viewDerivatives not understanding gql query variables #37

Open julpod opened 4 years ago

julpod commented 4 years ago

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

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!