Skip to content

GraphQL fluent query arguments cannot be cleared/updated, e.g. when paging with cursor (6.27.0) #1245

Description

@lanthonyneville

This is my use case:

  • I create a query for a set of products using a filter (i.e. with ProductsOperationQueryBuilder)
  • I set PageInfo on the query and set the "first" argument to the page size I want (e.g. 100)
  • I execute the query and check the results:
    • if pageInfo.hasNextPage is true then I add an "after" argument to the same query instance, setting it to the pageInfo.endCursor value
    • I execute this query instance again and repeat until pageInfo.hasNextPage is false

The issue is that repeated attempts to set the "after" argument fail with a "An item with the same key has already been added". It looks like this is because AddArgument in Query calls Add on a dictionary.

Could you maybe make AddArgument do an add/update rather than a straight Add on the dictionary?

Or is there another way to do this (without making a new query instance for each call)?

Thanks

PS- I also looked at configuring arguments with SetArguments(Action) but this also fundamentally uses IArgumentsBuilder so hits the same issue.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions