Skip to content

Correct way to unsubscribe from a current geoquery? #120

Description

@jackie-d

Hi,
I found that calling multiple times

const subscription = this.geo.query<any>(ref).within(center, radius, 'position', { log: true })

instances multiple listeners, even if a call to .unsubscribe is made.
Each time I leave a page and re-enter on it, a new listener is added, resulting in multiple query launched (visible from the console log).

ionViewDidEnter() {
    this.subscription = this.geo.query<any>(ref).within(center, radius, 'position', { log: true });
}

ionViewDidLeave() {
   this.subscription.unsubscribe();
}
index.esm.js:1475 GeoFireX Query
index.esm.js:1476 🌐 Center 03.7550653,01.2864031. Radius 1
index.esm.js:1477 📍 Hits: 1
index.esm.js:1478 ⌚ Elapsed time: 3255ms
index.esm.js:1479 🟢 Within Radius: 1

index.esm.js:1475 GeoFireX Query
index.esm.js:1476 🌐 Center 03.7550653,01.2864031. Radius 1
index.esm.js:1477 📍 Hits: 1
index.esm.js:1478 ⌚ Elapsed time: 3513ms
index.esm.js:1479 🟢 Within Radius: 1

Am I missing something or is this a known issue?

PS: The code provided is an exemplification, as I'm using it on a combineLatest structure and obviously using a subscribe() on the result.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions