Skip to content

Commit 2046fed

Browse files
author
Carlos Rufo Jimenez
committed
fix(pagination): index
1 parent 9bd5e1e commit 2046fed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/LinkList.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,17 @@ class LinkList extends Component {
170170

171171
const linksToRender = this._getLinksToRender(data)
172172
const isNewPage = this.props.location.pathname.includes('new')
173+
const pageIndex = this.props.match.params.page
174+
? (this.props.match.params.page - 1) * LINKS_PER_PAGE
175+
: 0
173176

174177
return (
175178
<Fragment>
176179
{linksToRender.map((link, index) => (
177180
<Link
178181
key={link.id}
179182
link={link}
180-
index={index}
183+
index={index + pageIndex}
181184
updateStoreAfterVote={this._updateCacheAfterVote}
182185
/>
183186
))}

0 commit comments

Comments
 (0)