facebook / facebook/relay

Cannot use @connection on fragment

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

Description

Using @connection on a fragment does not work:

TickerEventListWrapper.js
```
fragment TickerEventListWrapper_item on Ticker {
events(first: 10) {
...TickerEventList_items
}
}
```

TickerEventList.js
```
fragment TickerEventList_items on TickerEventConnection @connection(
key: "TickerEventList_items_events",
) {
edges {
node {
...TickerEvent_item
}
}
}
```

TickerEvent.js
```
fragment TickerEvent_item on TickerEvent {
id
}
```

Using @connection on `events(first: 10)` does also not work because it requires an `edges` key as an immediate child.

Contributor guide

Open the contributing guide

Research direction

Reproduce the example from TickerEventListWrapper.js, TickerEventList.js, and TickerEvent.js, starting with the fragment-level @connection usage and the immediate edges requirement. Trace Relay's handling of these fragments to determine the expected behavior and verify the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.