firestoreodm-flutter icon indicating copy to clipboard operation
firestoreodm-flutter copied to clipboard

ConnectionState is stuck in waiting status if coming from a page which used the same QuerySnapshot

Open Badane opened this issue 11 months ago • 0 comments

Expected Behavior

Hello, I connect to a same collection in different pages in my application. I use the FiresoreBuilder as so, in each page which need data from this "cellars" collection :

     FirestoreBuilder(
          ref: cellarsRef, 
          builder: (BuildContext context, AsyncSnapshot<CellarQuerySnapshot>snapshot, Widget? child) {
            if (snapshot.hasError) {
              print(snapshot.error.toString());
              return Center(child: Text('An error has occured!'));
            }
            if (snapshot.connectionState == ConnectionState.waiting) {
              return Center(
                child: CircularProgressIndicator(),
              );
            }

            CellarQuerySnapshot cellarSnapshot = snapshot.requireData;
            return Wrap(
              children: [
                for(int i=0;i<cellarSnapshot.docs.length;i++) ...{
 ...

My ""cellarsRef"" is declared in the model file and imported with the model in each page.

Actual Behavior

If I navigate to another page wich use the same FirestoreBuilder, the connectionState will be stuck with the waiting status. I have to navigate to a "clean" page, and come back to see my data correctly displayed. Do you have an idea how I can be sure that each connection is closed before I create another one ? Thank you

Specifications

  • Version: 1.0.0-dev.84
  • Platform: Web

Badane avatar Mar 19 '24 17:03 Badane