问题
Firestore can handle offline persistence but it doesn't seem to load cached datas first. Is that possible ? The app perf would seem much better if the local datas were loaded first.
If not possible, is there an easy way to get the local datas manually so I can do an Observable merge and load cached datas first.
Thanks a lot
EDIT:
I'm using angularfire2 with Ionic 3.
I'm expecting an offline first behavior from Firestore. Since valueChanges() returns an Observable, I think it should first emit the local value then when the remote datas have arrived emit the remote value.
For instance, if I do this:
return this.db.collection<HeroServerData>('game/heroes')
.valueChanges()
.map(heroes => heroes.map(hero => new Hero(hero)));
I can see that the data are cached locally but I still have to wait for the server response or a timeout (if offline) to get the datas
来源:https://stackoverflow.com/questions/46649022/firestore-serve-cached-datas-first