React relay default values are not working

18 Views Asked by At

I'm struggling while using argumentDefinitions with react-relay 16.2.0 and can't find why it is not working.

Globally I have something like that (I have also tried with useQueryLoader) :

const incidentsLinesPaginationQuery = graphql`
    query IncidentsLinesPaginationQuery(
        $count: Int
    ) {
    ...IncidentsLines_data
    @arguments(
      count: $count
    )
  }
`;

const IncidentsLinesFragment = graphql`
  fragment IncidentsLines_data on Query
  @refetchable(queryName: "IncidentsLinesRefetchQuery")
  @argumentDefinitions(
    count: { type: "Int", defaultValue: 25 }
  ) {
    incidents(
      first: $count
    ) @connection(key: "Pagination_incidents") {
      edges {
        node {
          id
        }
      }
    }
  }
`;

const Component = () => {
  const toto = useLazyLoadQuery(incidentsLinesPaginationQuery, {});
  ...
};

And when the query is sent I have "null" in variables. What am I missing ?

0

There are 0 best solutions below