firebase / firebase/FirebaseUI-Flutter

🐛 FirestoreListView renders (incomplete) local cache before remote db result

Ouverte
#238 13 commentaires 5 réactions 1 personne assignée Assignée à @russellwheatley Voir sur GitHub
bug firestore Keep Open Needs Attention
Langage dominant
Dart
Étoiles
151
Forks
141
Merge moyen
2 j 11 h
PR mergées (30 j)
6

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues and found no duplicates.

### What plugin is this bug for?

Firebase UI Firestore

### What platform(s) does this bug affect?

Web

### List of dependencies used.

flutter pub deps -s list

```
Our dependency list is very long, and contains private packages, therefore I only include the relevant firebase packages here:

- firebase_core 2.21.0
- firebase_core_platform_interface ^5.0.0
- firebase_core_web ^2.8.1
- flutter any
- meta ^1.8.0
- firebase_auth 4.12.1
- firebase_auth_platform_interface ^7.0.3
- firebase_auth_web ^5.8.6
- firebase_core ^2.21.0
- firebase_core_platform_interface ^5.0.0
- flutter any
- meta ^1.8.0
- firebase_messaging 14.7.3
- firebase_core ^2.21.0
- firebase_core_platform_interface ^5.0.0
- firebase_messaging_platform_interface ^4.5.12
- firebase_messaging_web ^3.5.12
- flutter any
- meta ^1.8.0
- firebase_crashlytics 3.4.3
- firebase_core ^2.21.0
- firebase_core_platform_interface ^5.0.0
- firebase_crashlytics_platform_interface ^3.6.11
- flutter any
- stack_trace ^1.10.0
- cloud_firestore 4.12.2
- cloud_firestore_platform_interface ^6.0.3
- cloud_firestore_web ^3.8.3
- collection ^1.0.0
- firebase_core ^2.21.0
- firebase_core_platform_interface ^5.0.0
- flutter any
- meta ^1.8.0
- firebase_ui_firestore ^1.5.7
```

### Steps to reproduce

- Do *not* enable Persistance on Web (default is -- as far as I know -- a small memory cache)
- Have `.snapshots()`-Stream on a single firestore document (lets call it _docA_ ); Render this document e.g. with a StreamBuilder.
- Next to that use the `FirestoreListView` to render a list of documents (including _docA_ ). The database should contain enough documents, to allow for multiple pages.
- Scroll down the `FirestoreListView` to trigger the "fetch more" functionality.
- Now the FirestoreListView will render a list only containing _docA_ for a very short amount of time and then render the full list. This results in the scroll position beeing lost and the whole list apparently jumping to the top.

### Expected Behavior

I would expect the List not jumping. And thereby, as far as I understood the bug, I would expect the list not rendering a single cached item inbetween list fetches. I would also be fine with disabling any caching behavior on web, if there's a way to do that.

### Actual Behavior

_(see steps to reproduce)_

### Additional Information

I briefly looked into the `FirestoreListView` code (`packages/firebase_ui_firestore/lib/src/query_builder.dart`) . If I'm not mistaken, the problems lies in the `query.snapshots().listen()`-Callback in lines 176 et seq. Here any data is "rendered", as long as its smaller then `expectedDocsCount`, which of course includes the one item eagerly returned by the cache.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.