facebook / facebook/relay

Error when using prependEdge directive on an aliased connection

Open
#3,522 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I currently get an error when using the `prependEdge` directive on a connection that has been aliased. Works fine for any connections not aliased.

**The error message:**
`The connection with id 'client:VXNlcjox:__ProfileCurrentGoals_currentGoals_connection' doesn't exist.`

**The connection with `goals` renamed to alias `currentGoals`:**
```graphql
fragment ProfileCurrentGoals_user on User
@argumentDefinitions(
count: { type: "Int", defaultValue: 10 }
cursor: { type: "String" }
)
@refetchable(queryName: "ProfileCurrentGoalsQuery") {
id
currentGoals: goals(first: $count, after: $cursor, isCompleted: false)
@connection(key: "ProfileCurrentGoals_currentGoals") {
edges {
cursor
node {
id
...GoalNode_goal
}
}
}
}
```

**The mutation:**
```graphql
mutation CreateGoalMutation($connections: [ID!]!, $input: CreateGoalInput!) {
createGoal(input: $input) {
successful
result {
goalEdge @prependEdge(connections: $connections) {
cursor
node {
...GoalNode_goal
}
}
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.