Reputation: 3944
When I update data in Firebase (either manually through the console, or through the web app), it seems that Firebase run some callbacks that make my retrieval app duplicate images.
The retrieval app queries data from Firebase, and put into a table:
var ref = firebase.database().ref("CURETALIASFREE/trial");
ref.orderByChild("complete").equalTo("true")
.on("value", function(snapshot) {
// code that parse snapshot and put into a table.
}
I have looked into network and consoles in the debug panel, but could not figure out why.
Any idea on how to fix this?
Upvotes: 0
Views: 348
Reputation: 38289
The on() method attaches the listener function and leaves it attached. The function is called once when attached and then again for any change to the location. If you only want the listener function to execute only one time, use once().
Upvotes: 1