Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct way to unsubscribe from a current geoquery? #120

Open
jackie-d opened this issue Apr 15, 2020 · 0 comments
Open

Correct way to unsubscribe from a current geoquery? #120

jackie-d opened this issue Apr 15, 2020 · 0 comments

Comments

@jackie-d
Copy link

jackie-d commented Apr 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant