Utilizing Firebase and Ionic framework (written in TypeScript).
When inserting a new entry (using the push method) into a collection (groups), it displays numerous temporary groups. I have subscribed to them using the on()
method and trigger an event when data changes. Therefore, whenever data is added to the database, the changes are immediately reflected on the client side without requiring any user interaction.
A few screenshots could better illustrate what is happening:
Before adding: https://i.sstatic.net/ovVS2.png
After adding a group (test_2) (immediately following a navctrl.pop()
):
https://i.sstatic.net/uPJIi.png
After triggering a list refresh or when navigating to a group chat and exiting: https://i.sstatic.net/NrTkm.png
If I directly delete 'test_2' from Firebase: https://i.sstatic.net/kwAte.png
None of these 'duplicates' exist within the database, only on the client side. After insertion, all duplicates are considered 'valid', but not after deletion (as it was removed from Firebase). This issue only occurs during data addition or deletion, not during initialization.
Is there a way to prevent this behavior?