0π
β
I think this is due to the fact that you donβt re-initialize the usersList
array in your listener.
So, you populate it once when the page is first displayed and then, when the record is deleted in the back end, the (still) existing records in the database are (again) pushed to the initial array.
If you do something like the following it should work:
initUsers() {
firebase
.database()
.ref('/users')
.on('value', snapshot => {
this.usersList = []; //<-- init to empty array
snapshot.forEach( childSnapshot => {
this.usersList.push({
username: childSnapshot.val().email,
admin: childSnapshot.val().admin,
id: childSnapshot.key
})
})
});
},
Source:stackexchange.com