Permalink
Browse files

⚠️ `hasPreviousPage` & `hasNextPage` are deprecated.

Please test directly the existance of `previous` and `next`.
It will continue to work for a while tho, but will be remove some day.
  • Loading branch information...
MoOx committed Jan 11, 2018
1 parent 58a929d commit 69361b82c856f30727ec5588b098f31831be5637
@@ -130,7 +130,7 @@ const ShowcaseList = (props: Object) => (
<View style={styles.paginationRow}>
<View style={styles.paginationColumn}>
{props.showcase.node &&
props.showcase.node.hasPreviousPage && (
props.showcase.node.previous && (
<Link
style={styles.link}
href={
@@ -149,7 +149,7 @@ const ShowcaseList = (props: Object) => (
</View>
<View style={styles.paginationColumn}>
{props.showcase.node &&
props.showcase.node.hasNextPage && (
props.showcase.node.next && (
<Link
style={styles.link}
href={`/showcase/${
@@ -32,7 +32,7 @@ const Home = ({ isLoading, posts }) => (
)}
<div>
{posts.node &&
posts.node.hasPreviousPage && (
posts.node.previous && (
<Link
to={
posts.node.previousPageIsFirst
@@ -44,7 +44,7 @@ const Home = ({ isLoading, posts }) => (
</Link>
)}{" "}
{posts.node &&
posts.node.hasNextPage && (
posts.node.next && (
<Link to={`/after/${posts.node.next}/`}>Older posts</Link>
)}
</div>
@@ -17,16 +17,17 @@ const connect = (list, limit, previousList = []) => {
const previousIndex = previousList.length - 1 - (previousPageIsFirst ? 0 : 1);
const nextIndex = list.length - 1;
return {
hasPreviousPage,
previousPageIsFirst,
previous:
hasPreviousPage && previousList[previousIndex]
? encode(previousList[previousIndex].id)
: undefined,
hasNextPage,
next:
hasNextPage && list[nextIndex] ? encode(list[nextIndex].id) : undefined,
list: list.slice(0, limit)
list: list.slice(0, limit),
// deprecated
hasNextPage,
hasPreviousPage
};
};
@@ -23,7 +23,7 @@ page! Let's add a link in our Home, after our list of posts
```js
<div>
{posts.node &&
posts.node.hasNextPage && (
posts.node.next && (
<Link to={`/after/${posts.node.next}/`}>Older posts</Link>
)}
</div>;
@@ -68,7 +68,7 @@ Oh and before continuing, you should add another simple link for "Newer posts"
```js
<div>
{posts.node &&
posts.node.hasPreviousPage && (
posts.node.previous && (
<Link
to={
posts.node.previousPageIsFirst

0 comments on commit 69361b8

Please sign in to comment.