facebook/relay

[modern] Same field queried with different arguments overwrites proper results

Open

#2 024 ouverte le 9 août 2017

Voir sur GitHub
 (2 commentaires) (1 réaction) (0 assignés)Rust (1 874 forks)batch import
bughelp wantedwontfix

Métriques du dépôt

Stars
 (18 930 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Given query:

query UsersStatisticsQuery(
  $monthAgo: DateTime!,
  $twoMonthsAgo: DateTime!,
  $threeMonthsAgo: DateTime!,
  $fourMonthsAgo: DateTime!,
  $fiveMonthsAgo: DateTime!
  $sixMonthsAgo: DateTime!
) {
  root {
    statistics {
      usersUpToNow: users_count
      usersUpToMonthAgo: users_count(registered_before: $monthAgo)
      usersUpToTwoMonthsAgo: users_count(registered_before: $twoMonthsAgo)
      usersUpToThreeMonthsAgo: users_count(registered_before: $threeMonthsAgo)
      usersUpToFourMonthsAgo: users_count(registered_before: $fourMonthsAgo)
      usersUpToFiveMonthsAgo: users_count(registered_before: $fiveMonthsAgo)
    }
  }
}

in GraphiQL it gets properly returned:

{
  "data": {
    "root": {
      "statistics": {
        "usersUpToNow": 1282,
        "usersUpToMonthAgo": 1248,
        "usersUpToTwoMonthsAgo": 1156,
        "usersUpToThreeMonthsAgo": 1071,
        "usersUpToFourMonthsAgo": 968,
        "usersUpToFiveMonthsAgo": 737,
      }
    }
  }
}

However, in component:

usersUpToNow: 1282
usersUpToMonthAgo: 1248
usersUpToTwoMonthsAgo: 1248
usersUpToThreeMonthsAgo: 1248
usersUpToFourMonthsAgo: 1248
usersUpToFiveMonthsAgo: 1248

Well… I think it shouldn't have duplicated wrong values. react-relay@^1.1.0

Guide contributeur