adriancarriger / angularfire2-offline

🔌 A simple wrapper for AngularFire2 to read and write to Firebase while offline, even after a complete refresh.
https://angularfire2-offline.firebaseapp.com/
MIT License
207 stars 48 forks source link

after calling AngularFireOfflineDatabase.list() it keeps being subscribed to firebase events even when list ref is no longer in use. #30

Closed ciekawy closed 7 years ago

ciekawy commented 7 years ago

not sure how this should look like yet I can see setupList (and setupObject) to call ref.subscribe() and never unsubscribe, also the listCache (and objectCache) seem to keep cached values forever. As a result I can see AngularFireOfflineDatabase.setList() is being called for each internal and external list modification. Probably there should be at least some optional strategies available to automatically/manually clear cache entries and unsubscribe from firebase updates.

Other thing is that for any list modification (i.e. for child_added) always all list is being processed which is probably a candidate for separate issue.

adriancarriger commented 7 years ago

@ciekawy turns out there's already a PR for this.. I'm just waiting on some minor changes. Feel free to check it out and leave feedback here.

Also, a more efficient way to modify lists would be nice! 👍