googlearchive / firebase-util

An experimental toolset for Firebase
http://firebase.github.io/firebase-util
MIT License
276 stars 67 forks source link

[Paginate] Using $key for sorting in the infinite scroll doesn't work #92

Open pdesgarets opened 8 years ago

pdesgarets commented 8 years ago

It works only for few scrolls, then ( I guess when the cache is not big enough) it calls startAt with 2 arguments, the second being the key if the sorting field is '$key'. And Firebase does not like having 2 arguments in startAt on an orderByKey query.

See http://plnkr.co/gfbHcaOKYvRH4txja4dR

I put there a kind of fix in firebase-util-tweaked.js, replacing all startAt(key.val, key.key) by startAt(key.val, this.field === '$key' ? undefined : key.key) (approximately), please tell me if I should make a PR of it.