MichaelSolati / geofirestore-js

Location-based querying and filtering using Firebase Firestore.
https://geofirestore.com
MIT License
505 stars 58 forks source link

key_exited fires after ready event #44

Closed dramentol closed 6 years ago

dramentol commented 6 years ago

Hi,

I'm listening for documents with a fixed query that won't change. But when I remove a document that affects the query results, "ready" event gets fired before "key_exited".

Is that the right behaviour?

MichaelSolati commented 6 years ago

Could I see all relevant code please? 🤔

dramentol commented 6 years ago

Here is the code:

const query = this.geofirestore.query({
  center: new firebase.firestore.GeoPoint(41.3947688, 2.0787283),
  radius: 50
} as QueryCriteria);

query.on("ready", () => console.log("test ready"));
query.on("key_entered", (key, document, distance) => console.log("test key_entered", key));
query.on("key_exited", (key, document, distance) => console.log("test key_exited", key));

If after 1st "ready" I remove a document from the firebase console, I get a new "ready" followed by a "key_exited".

MichaelSolati commented 6 years ago

Hey @dramentol I'm sorry to say this only because my main focus is v3.0.0 right now. With the release of 3.0.0 this will cease to be an issue as the entire system will change (and hopefully for the better).

dramentol commented 6 years ago

I understand, @MichaelSolati. Thank you anyway. I can't wait to see the new version.

len-art commented 5 years ago

This may have something to do with Google's code. Same thing randomly (lots of times) happens when using real-time database with GeoFire.