Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default createPaginationContainer(
- ProductsList,
- {
- products: graphql`
- fragment ProductsList_products on Products
- @argumentDefinitions(
- count: { type: "Int", defaultValue: 10 }
- cursor: { type: "ID" }
- ) {
- products(
- first: $count
- after: $cursor
- ) @connection(key: "Product_product") {
- edges {
- node {
- id
- ...Product_product
- }
- }
- pageInfo {
- startCursor
- endCursor
- }
- }
- }
- `
- },
- {
- direction: 'forward',
- getConnectionFromProps(props) {
- return props.products;
- },
- getFragmentVariables(prevVars, totalCount) {
- return {
- ...prevVars,
- count: totalCount,
- };
- },
- getVariables(props, {count, cursor}, fragmentVariables) {
- return {
- count,
- cursor,
- };
- },
- query: graphql`
- query ProductsListQuery {
- products(
- first: $count
- after: $cursor
- ) {
- edges {
- node {
- id
- ...Product_product
- }
- }
- pageInfo {
- startCursor
- endCursor
- }
- }
- }
- `
- }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement