3

In my NodeJS application, I use the once("value") function instantly when the page loads, which fetches all the data in my database and initializes the data in my app. I then have an limitToLast(1).on('child_added') listener that listens to when the last element is added to the database.

However, when the user reloads the page, this listener fires because of the existing child and not because a new element has been added, so it's sending the last element to my client side, which is not what I want because that data is already there. I've read the documentation but was wondering if there is a way to prevent the listener from firing every time the user reloads the page and only fire when a new element is actually added to the database.

user3226932
  • 2,042
  • 6
  • 39
  • 76

0 Answers0