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

{preserveSnapshot: true} is ignored #33

Closed larssn closed 7 years ago

larssn commented 7 years ago

When you reference a location you can send the param in the topic, for example: this.db.object('users/user1', {preserveSnapshot: true})

However this param gets ignored in AFO.

The param is described here: https://github.com/angular/angularfire2/blob/master/docs/2-retrieving-data-as-objects.md#retrieving-the-snapshot

adriancarriger commented 7 years ago

Thanks for bringing this up! I'll look into what can be done to solve this. 👍

adriancarriger commented 7 years ago

@larssn I'm curious about your use case. Do you need access the the snapshot while offline? Would it be acceptable to just get the snap only while online?

The issue I'm running into is that the snapshot contains functions, and it doesn't look like localForage is designed to store functions.

larssn commented 7 years ago

The use case in our case is in the context of a mobile app: The user can run in and out of wifi-range potentially, and transparency in regards to whether you are online or offline would be nice.

However, I can see that it might be hard to create snapshot functionality when offline.

So my suggestion is: Keep it simple, remove support for data snapshots completely so it doesn't confuse anyone. Maybe make a note of it in the readme.

adriancarriger commented 7 years ago

Sounds good! Thanks @larssn