Skip to content

Commit

Permalink
Bugfixes (cumulative pagination should work now).
Browse files Browse the repository at this point in the history
  • Loading branch information
Olovorr committed Apr 11, 2022
1 parent 281f050 commit d2e56c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# use-pagination-firestore

A React Hook that makes it easy to paginate firestore collections.
This hook is similar, but the not the same as
[firestore-pagination-hook](https://github.com/bmcmahen/firestore-pagination-hook). This hook
provides _non cumulative_ pagination and does _not_ maintain references to previous
A React Hook that makes it easy to paginate firestore collections. This hook
provides _cumulative_ pagination and does maintain references to previous
documents, so it might be suitable for large document sets.

This hook is forked to __be cumulative__.

## Support for Firebase 9

Versions 0.6.x add support for Firebase 9 and are backwards _incompatible_ with previous versions of Firebase. For support for Firebase 8.x, use versions 5.x of `use-pagination-firestore`.
Versions 0.7.x add support for Firebase 9 and are backwards _incompatible_ with previous versions of Firebase. For support for Firebase 8.x, use versions 5.x of `use-pagination-firestore`.

## Install

Expand Down Expand Up @@ -145,4 +145,4 @@ const RecentPerfumes = () => {

Paginating Firestore documents relies on [query cursors](https://firebase.google.com/docs/firestore/query-data/query-cursors). It's not easy to know
ahead of time how many documents exist in a collection. Consequently, if your `document_count % page_size` is `0` you will notice that your last page
is empty – this is because this hook doesn't (currently) look ahead to know if there are any more documents.
is empty – this is because this hook doesn't (currently) look ahead to know if there are any more documents.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "use-pagination-firestore",
"version": "0.6.0",
"description": "A non-cumulative pagination hook for use with Firestore",
"version": "0.7.1",
"description": "A cumulative pagination hook for use with Firestore",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const getReducer = <T extends DocumentData>() => (state: State<T>, action: Actio
isLoading: false,
lastDoc,
nextQuery,
items,
items: state.items.concat(items),
isEnd: items.length < state.limit,
};
}
Expand Down

0 comments on commit d2e56c8

Please sign in to comment.