perch-query-builder icon indicating copy to clipboard operation
perch-query-builder copied to clipboard

Always select primary keys

Open Migushthe2nd opened this issue 4 years ago • 2 comments

Fixes #9

This PR makes it so that the primary columns are always selected. This will prevent joined relations from becoming null if no table column is selected

Migushthe2nd avatar Sep 25 '21 10:09 Migushthe2nd

This PR requires additional work in order to support for example __typename. Since it is not included in the tree.fields, the join (previews below) is added, but no field is selected. An example query would be

query {
  layout(id: "db") {
    previews {
      __typename
    }
  }
}

Migushthe2nd avatar Sep 25 '21 14:09 Migushthe2nd

Additional check was implemented. It will now check in the EntityMetadata if a field is a relation, instead of checking if field.fields.length > 0. This fixes __typename.

Migushthe2nd avatar Sep 25 '21 17:09 Migushthe2nd