question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] Is there a way to alter limitToLast value?

See original GitHub issue

Hello, I try to create a simple pagination based on scrolling. When scroll touches the top, contentCount increases. So, we alter limit actually but it does not effect the result.

const [contentCount, setContentCount] = useState(9)
const firebaseApp = useFirebaseApp();
 const ref  firebaseApp.database().ref('dialogContents').orderByKey().limitToLast(contentCount);

What is the best way to change this limit?

Best regards

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

2reactions
jhuleattcommented, Oct 23, 2019

Hey @MuratDoner , this is caused by a bug in ReactFire where it failed to requery if limitToLast or other query modifiers were changed. It will be fixed by #167

1reaction
MuratDoner-zzcommented, Nov 2, 2019

Hey @jhuleatt, It works like a charm now 😃 Sample: https://codesandbox.io/embed/elated-dijkstra-7u6i7?fontsize=14

When limit increases, list size also increases until the maximum data size (25)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change limitToLast dynamically - firebase - Stack Overflow
If you have a query like this: var query = ref.orderByKey().limitToLast(10). And you want to change the number of items shown, you will...
Read more >
Collection Queries with Firebase
Review value and child_added events in the docs and answer the following questions. Which event is best for returning a single item? Which...
Read more >
Work with Lists of Data on the Web - Firebase - Google
On this page · Get a database reference · Reading and writing lists. Append to a list of data; Listen for child events;...
Read more >
firebase get last 10 items | The AI Search Engine You Control
Here we will use the DatabaseReference ;s methods which are limitToFirst(int) OR limitToLast(int) to get the first or last records from FireBase ....
Read more >
Best Practices: Arrays in Firebase
If you store an array, it really gets stored as an "object" with integers ... time to remove 'bar'! // this is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found