facebook / facebook/relay

[question] Alias on pagination fragment of root Query

Open
#3,217 1 comment 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

Is it possible or design think that i`m not able to create alias on fragment...

I have example schema:

```
type Querry {
currentUserIssues(
after: String
before: String
first: PaginationAmount
last: PaginationAmount
order_by: GQL_IssueSort
where: GQL_IssueFilter
): GQL_IssueConnection

```

I have reusable component which use `currentUserIssues` as pagination fragment... In total 3x equal component inside but top filters can changed...

```
fragment Board_connectedIssues on Query
@argumentDefinitions(
first: { type: PaginationAmount }
after: { type: String }
filters: { type: GQL_IssueFilter }
)
@refetchable(queryName: "BoardPaginationRefetchQuery") {
currentUserIssues(
where: $filters
first: $first
after: $after
order_by: { changedTimestamp: DESC }
) @connection(key: "BoardPaginationConnection_connectedIssues") {
totalCount
edges {
node {
id
systemid
...BoardItemAssigned_Fragment
}
}
}
}
`;
```

**How i can create alias not this from top component where main query is?**

Because this alias on fragment is not allowed.

```
query WorkBoardQuery(
$user_id: Long!
$first: PaginationAmount
$Scheduled: GQL_IssueFilter
$Requested: GQL_IssueFilter
) {
Requested: ...Board_connectedIssues @arguments(first: $first, after: $after, filters: $Requested)
Scheduled: ...Board_connectedIssues @arguments(first: $first, after: $after, filters: $Scheduled)
...
...
```

I know alias will work if it is it is nasted like `me{currentUserIssues}` but how to alias pagination fragment of root query?

Because on end i need to pass tis to my reusable component...

Just example
```
<>






...
...

```

If it is nasted all works because alias can be created like in example down if it is under `me{...}`

```
Requested: me {
...Board_connectedIssues
@arguments(first: $first, after: $after, filters: $Requested)
}

Created: me {
...Board_connectedIssues
@arguments(first: $first, after: $after, filters: $Created)
}

```

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.