Giter Club home page Giter Club logo

react-firebase-pagination-hooks's Introduction

react-firebase-pagination-hooks

This repository is heavily based on firestore-pagination-hook and react-firebase-hooks. modified firestore-pagination-hook so that we can use it like react-firebase-hooks

Install

yarn add react-firebase-pagination-hooks
npm i react-firebase-pagination-hooks

react-firebase-pagination-hooks's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar kodai3 avatar mnightingale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-firebase-pagination-hooks's Issues

Can't query with 'where' and 'orderBy'

I getting an issue with ref.where.orderBy
It's only work with ref.where without orderBy or ref.orderBy without where

ex: firestore().collection('leaderboard').where('kyc', '==', true).orderBy('date', 'asc')

Paginate data with query cursors

As I understand it currently queries don't really paginate, the query limit is just continuously increased and any duplicate ids are ignored.
i.e. it queries for 20 items, then 40, 60, 80, etc.
In some cases this can cause a lot of document reads.

Would a PR be welcome that uses the firestore pagination methods Paginate data with query cursors ?

I don't think this would cause an issue, startAt requires a orderBy but so does limit.

I was thinking something like:

stepLimit + 1 because I choose to use startAt rather than startAfter in case there are multiple items with the same order key and I want stepLimit extra items.

let queryLimited = ref.current

if (after !== null) {
  queryLimited = queryLimited.startAt(after).limit(stepLimit + 1)
} else {
  queryLimited = queryLimited.limit(stepLimit)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.