The following code creates an infinite loop of repeated child_added, although I never add a child. Nodes are deleted. I just loop forever. How can i fix this?
//notifications branch is pre-populated when I get here: notifications.startAt(null).on('child_added', processNotification, logError); function processNotification(notification) { removeNotification(notification); } function removeNotification(notification) { var child = notifications.child(notification.name()); console.log("REMOVING", child.toString()); child.remove(); }
What I am registering, the same four nodes (A, B, C, D) are deleted:
REMOVING https://my.firebaseio.com/experimental/-JVMi0_4poXfOWUt5g49 - A REMOVING https://my.firebaseio.com/experimental/-JVMi1Y_bFwZAkffRel4 - B REMOVING https://my.firebaseio.com/experimental/-JVMi2lyhKj8z27ik71x - C REMOVING https://my.firebaseio.com/experimental/-JVMhzazdgHYAstqxu8L - D REMOVING https://my.firebaseio.com/experimental/-JVMi0_4poXfOWUt5g49 - A REMOVING https://my.firebaseio.com/experimental/-JVMi1Y_bFwZAkffRel4 - B REMOVING https://my.firebaseio.com/experimental/-JVMi2lyhKj8z27ik71x - C REMOVING https://mu.firebaseio.com/experimental/-JVMhzazdgHYAstqxu8L - D ...
source share