2017-06-22 1 views
0

Ich weiß nicht, warum meine loadMore funktioniert nicht, dies ist mein Code in meinem Paginierung:Ich kann loadMore nicht tun, da hasMore() immer false zurückgibt, selbst wenn hasNextPage wahr ist?

todos(first: $count # count is default to 2 
     ) @connection(key: "TodoList_todos") { # 
      edges { 
      cursor 
      node { 
       id, 
       complete, 
       ...Todo_todo, 
      } 
      } 
      pageInfo { 
       endCursor 
       hasNextPage 
       hasPreviousPage 
       startCursor 
      } 

Warum sollte meine hasMore() return false wenn hasNextPage true zurückgibt? Wie repariere ich das?

Antwort

1

setzen Sie getConnectionFromProps?
Wahrscheinlich müssen wie props.todos sein.

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 
     } 
    ` 
    } 
); 
Verwandte Themen