-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Currently the method generateGeoQueryDocumentSnapshot() returns a QueryDocumentSnapshot.
This only exposes a few methods or properties compared to a Firebase QueryDocumentSnapshot.
This means that what one can expect from either a generic Query or a GeoQuery is very different,
making passing results to generic functions a bit non unified (talking about geofirestore-js here).
With version v2.2.3 of geofirestore-js I had patched (but not PR'ed) theQueryDocumentSnapshot.
So it would expose QueryDocumentSnapshot methods, making it a drop-in replacement/addition.
As a sketch/conversation starter I did the same thing for the 5.0.0 version of geofirestore-core
This means that the implementing geofirestore-js would start to return the missing methods.
Now I say as a sketch, because I struggle with TypeScipt ( hence :any ),
and there are probably some semantics or reasons to take into account.
The commit does a few things.
Types
- It renames the type
GeoFirestoreTypes.QueryDocumentSnapshottoGeoFirestoreTypes.QueryDocumentSnapshotData, as the type was more...Datathan...Snapshot -
- for the method
decodeGeoQueryDocumentSnapshotData(), typeQueryDocumentSnapshotDatais still semantically valid and used
- for the method
- The previous, type
GeoFirestoreTypes.QueryDocumentSnapshotis updated to extend theFirebase.QueryDocumentSnapshottype, (exposing all methods) and addingdistance : number
Methods
generateGeoQueryDocumentSnapshot()now returns the original snapshot methods, and properties, but overwritingdata()withdecoded.data()and adding{distance : decoded.distance}
I wonder if this would be a good addition or if there are reasons why (not) to return the original snapshots.