Open Skrigueztep opened 2 years ago
Honestly this doesn't really look like an issue with AngularFire since this is (I think) expected behaviour. You could do it yourself with a try catch. If it errors you can make an empty collection yourself.
If someone delete a collection users that have cached elements receive no extra event to invalidate cache data. For example:
return this.angularFirestore.collection
path, queryFunction
).valueChanges({idField: 'UID'})
...
produce only one event containing cached data and will only produce a event again if collection is created. I would appreciate a solution.
Version info
Angular: 12.2.14
Firebase: 9.4.0
AngularFire: 7.2.1
Other (e.g. Ionic/Cordova, Node, browser, operating system):
Windows: 10 Node: 14.18.2 NPM: 6.14.15
How to reproduce these conditions
Failing test unit, Stackblitz demonstrating the problem
Steps to set up and reproduce
Sample data and security rules
Debug output
Errors in the JavaScript console
ERROR FirebaseError: Invalid document reference. Document references must have an even number of segments, but has 1.
Output from
firebase.database().enableLogging(true);
Nothing
Screenshots
Expected behavior
1.-
If a collection not exist and it is requested, should return a value that indicate this, like: null, undefined, [], etc.... in the best way, that collection, should be created automatically insted of return an error in console (by security reasons maybe)
or 2.-
A method to check if collection exist is expected, like
this.firestore.collection(' ').exist()
<-- Return booleanActual behavior
Throws following error: ERROR FirebaseError: Invalid document reference. Document references must have an even number of segments, but has 1.