facebook / facebook/relay

loadNext set params to null that not include pagination-fragment

Open
#4,559 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

this is my query
```typescript
export const searchUserQuery = graphql`
query searchUserQuery(
$groupId: ID!
$first: Int!
$userName: String
) {
node(id: $groupId) {
... on Groups {
id
...searchUsersPaginationFragment
@arguments(first: $first, name: $userName)
}
}
}
`

export const searchUsersPaginationFragment = graphql`
fragment searchUsersPaginationFragment on Groups
@argumentDefinitions(
first: { type: "Int!" }
after: { type: "String", defaultValue: null }
name: { type: "Stirng" }
)
@refetchable(queryName: "usersPaginationQuery") {
users(first: $first, after: $after, name: $name)
@connection(key: "usersPaginationFragment__users") {
edges {
node {
id
name
}
}
}
}
`
```
use the query like
```typescript
function App() {
const { node: paginationRef } = useLazyloadQuery(searchUserQuery, {
first: 1,
groupId: "xxx",
userName: "yyy"
})

const { data, loadNext } = usePaginationFragment(searchUsersPaginationFragment, paginationRef)

function loadNextPage() {
loadNext(10, {
UNSTABLE_extraVariables: {
groupId: "xxx", // use extraVariables alse set to null
}
})
}

return
}
```
but loadNext fetched query set groupId to null, variables is here
```
{ after: "xxxxxxx", first: 10, groupId: null, userName: "yyy" }
```

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.