Skip to content

Race condition in valueChanges() #2728

@DraviaVemal

Description

@DraviaVemal

Race condition happening in valueChanges() of doc [subscribe keeps firing with no data change in document].
The issue is happening in angular prod build, Dev build works fine.
Tested downgrading the package to AngularFire v6.0.5, the issue is not replicable.

Version info

**Angular: 10.2.3

**Firebase:8.2.1

**AngularFire:6.1.4

How to reproduce these conditions

sample code

this.getString()
      .pipe(switchMap((docName) => {
        if (docName !== '') {
          return this.angularFireStore.collection(eColName.PublicCol).doc(docName).valueChanges();
        }
      })).pipe(filter(val => val !== null))
      .subscribe(
        (publicDocData) => {
          this.publicData.next(publicDocDataa);
        }
      );

Debug output

NA

Expected behavior

Subscribe method should execute on start and on doc change

Actual behavior

Subscribe method executed like while loop without any end

Details I'm not sure is relevant:
Tsconfig:
"module": "es2020",
"target": "ES2015",
Angular dev and Prod build diff.
optimization & buildOptimizer are true in prod rest are same

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions