Skip to content

GraphQL queries for interfaces return the same entity multiple times #1438

@lutter

Description

@lutter

The following query against protofire/roken-registry(QmaTK1m8VszFp7iijbWrX65iN8e5zogvJYvUAck7HEvAtQ) shows the problem:

query getTokensWithEvents {
  tokens(first: 2) {
    id
    symbol
    events(first: 5, orderBy: timestamp, orderDirection: desc) {
      __typename
      id
    }
  }
}

The result has 20 events for each token, rather than the 5 that were requested. The problem is in the GraphQL processing (graphql::store::prefetch), the underlying SQL query correctly returns 5 events for each token. The first 5 events for each token are the requested events in the correct order.

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