Reputation: 5968
I don't know why my loadMore doesn't work, this is my code in my pagination:
todos(first: $count # count is default to 2
) @connection(key: "TodoList_todos") { #
edges {
cursor
node {
id,
complete,
...Todo_todo,
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
Why would my hasMore() return false when hasNextPage returns true? how do I fix this?
Upvotes: 0
Views: 621
Reputation: 29
Are you setting getConnectionFromProps?
Probably need to be like props.todos.
module.exports = createPaginationContainer(
Todos,
{
todos: graphql`
todos(first: $count # count is default to 2
) @connection(key: "TodoList_todos") { #
edges {
cursor
node {
id,
complete,
...Todo_todo,
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
`
},
{
direction: 'forward',
getConnectionFromProps: props => props.todos,
getFragmentVariables: (vars, totalCount) => ({
...vars,
count: totalCount,
}),
getVariables: (props, {count, cursor}) => ({
count,
cursor
}),
environment: environment,
query: graphql`
query TodosPaginationQuery($count: Int!, $cursor: String) {
...ShopList_shops
}
`
}
);
Upvotes: 1