Skip to content

ra-data-graphql-simple: problem GET_MANY_REFERENCE in buildVariables.js #2571

Description

@wmwart

Hi.

export const  UserEdit = props => {
    return (
        <Edit {...props}>
            <SimpleForm>
                <DisabledInput source="id" />
                <TextInput source="name" />
                <ReferenceManyField
                    reference="Customer"
                    target="userId"
                >
                    <Datagrid>
                        <TextField source="organizationName" />
                    </Datagrid>
                </ReferenceManyField>
            </SimpleForm>
        </Edit>
    );
}

It was expected that the record would be returned as in the documentation.

The query filter gets an object in the object, which prevents you from working further.
expected filter:
variables: {filter: {userId:"cjoa0w1z5005y0b91ka78ug3r"}}

Here's what gets into Request payload:

{operationName: "allCustomers", variables: {filter: {id: {id: "cjoa0w1z5005y0b91ka78ug3r"}}},…}
operationName: "allCustomers"
query: "query allCustomers($filter: CustomerFilter) {↵  items: allCustomers(filter: $filter) {↵    id↵    type↵    organizationName↵    organizationInn↵    payment↵    __typename↵  }↵  total: _allCustomersMeta(filter: $filter) {↵    count↵    __typename↵  }↵}↵"
variables: {filter: {userId: {id: "cjoa0w1z5005y0b91ka78ug3r"}}}
filter: {userId: {id: "cjoa0w1z5005y0b91ka78ug3r"}}
userId: {id: "cjoa0w1z5005y0b91ka78ug3r"}
id: "cjoa0w1z5005y0b91ka78ug3r"

the response from the server:

operationName: null
link.js:48
variables:
link.js:49
{
link.js:50
  "_v0_where": {
    "AND": [
      {
        "userId_contains": "[object Object]"
      }
    ]
  },
  "_v1_orderBy": "id_ASC"
}

  • React-admin version: 2.4.2
  • Last version that did not exhibit the issue (if applicable):
  • React version:16.5.2
  • Browser: Chrome 70.0.3538.110
  • Use: ra-data-graphql-simple

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions