Comments (5)
Hello @abineshPalanisamy Thank you for sharing an issue. I see that _buildListView
is being called in build. and it has some logic to add to the list employeeData
so it can result in duplicate data.
Can you refactor this and test atain?
from flutterfire.
Hi @TarekkMA
When setState is called, snapshot.data.docChanges
gets reinitialized and behaves as if it is the initial loading by providing all the documents in the Firestore collection with the type DocumentChangeType.added. This can cause duplicate values to be built. On initial loading of the application, snapshot.data.docChanges correctly provides documents with DocumentChangeType.added, which is expected and fine. However, upon calling setState, it again provides all documents in the Firestore collection as snapshot.data.docChanges with DocumentChangeType.added
, even if there have been no changes or modifications in Firestore.
We performed logic in the _buildListView
method based on snapshot.data.docChanges. Therefore, I concluded that snapshot.data.docChanges
behaves improperly when setState is called in the application. This improper functioning leads to duplicate values.
Regards,
Abinesh P
from flutterfire.
Calling add
in build method will lead to duplicate values, Can you construct the list employeeData
only once and try again?
from flutterfire.
Hey @abineshPalanisamy. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
from flutterfire.
Hi @TarekkMA ,
I believe that the add
method is not the cause of the duplicate values. Based on snapshot.data.docChanges, we have added the data from Firestore to the ListView.Builder
. Therefore, an improper function of snapshot.data.docChanges leads to the duplicate values.
According to the previous response, when setState is called, snapshot.data.docChanges gets reinitialized and behaves as if it is the initial loading by providing all the documents in the Firestore collection with the type DocumentChangeType.added. This is the root cause of the issue. My concern is why snapshot.data.docChanges
gets reinitialized and behaves as if it is the initial loading when setState is called in the application. snapshot.data.docChanges should maintain its state even when we rebuild the app by calling setState.
Regards,
Abinesh P
from flutterfire.
Related Issues (20)
- FIREBASE_AUTH: CRASH ON WINDOWS WHEN USE sendEmailVerification() AND sendPasswordResetEmail(email)
- 👉FCM V1 👈_firebaseMessagingBackgroundHandler flutter_incoming_call sound not working and awesome_notifications incoming call sound not working ⚠⚠⚠⚠⚠ HOT 2
- firebase_dynamic_links: Frequent Crashes on Startup Due to Firebase Initialization Issue HOT 1
- [cloud_firestore]: missing increment updates when unstable internet connection HOT 2
- [📚] How to build and run the docs in localhost? HOT 1
- 🐛 [VectorStore] Dart SDK for Vector Store and vector search HOT 1
- [📚] Missing Windows information in "Add Firebase to your Flutter app" HOT 2
- [firebase_messaging]: getInitialMessage() doesn't work as expected on ios HOT 4
- firebase_core: Firebase won't initialize app on Flutter Web! HOT 3
- cloud_firestore: unsupported option '-G' for target 'x86_64-apple-ios10.0-simulator' HOT 3
- [storage] Cannot compile HOT 3
- include of non-modular header inside framework module 'firebase_messaging.FLTFirebaseMessagingPlugin' HOT 6
- [firebase_storage]: creationTimeMillis and updatedTimeMillis null on Windows platform HOT 2
- [firebase_core]: Using `demoProjectId` doesn't actually connect to demo project
- How to disable the recaptcha flow in firebase phone authentication (Flutter) HOT 6
- [firebase_analytics]: typing of event parameters to Map<String, Object>? is not working HOT 4
- [CLOUD_FIRESTORE]: Seconds are not considered on clause isGreaterThanOrEqualTo on Windows HOT 2
- [storage]: Unknown Error (Message too long) while uploading image on iOS HOT 4
- 🐛 [firebase_analytics] Add support for InitiateOnDeviceConversionMeasurement with hashed credentials
- [📚] Custom sound FCM ios device HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutterfire.