Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Optional input is set to null #1569

Closed
@jurajkrivda

Description

@jurajkrivda

Hello. I have a "users" request with userFilterInput which is optional. In my case i do not set the filter. Apollo will send this request to the server

{"operationName":"users","variables":{"userFilterInput":null},"query":"query users($userFilterInput: UserFilterInput) {\n  users(userFilterInput: $userFilterInput) {\n    id\n    email\n    lastName\n    firstName\n    __typename\n  }\n}\n"}

Why userFilterInput is set to null and not to undefined? Bellow you can find my code and you can see that I did not set up any filter.

export const USERS = gql`
  query users($userFilterInput: UserFilterInput) {
    users(userFilterInput: $userFilterInput) {
      id
      email
      lastName
      firstName
    }
  }
`;

export default graphql(USERS, {
  options: () => ({
    notifyOnNetworkStatusChange: true,
  }),
  props: ({ data: { loading, error, users, networkStatus, refetch } }) => ({
    usersLoading: loading,
    usersError: error,
    usersRefetch: refetch,
    users,
    networkStatus,
  }),
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions