Closed miduch closed 6 years ago
Sounds strange. What if you change the data from your App? Did you see any message in your debug output that you have to add a FireStore index?
I saw that message when running query, clicked on link and it created index. After that query returns correct/filtered results.
I can try to push some data from app side to see what happens
Wait, I'm not clear what you problem is. Is it that you get the whole collection updated when a single document changed or that the constraints are ignored in that case? The former is the default behavior.
“constraints are ignored in that case“.
Suppose I have 5 items and by applying constraints I get back item 2 only. After that I am listening to that stream. While listening I go to FB console and update item 4. In app stream gives me all 5 items this time.
If this is default behavior then is there a way to avoid this? And still have my query valid?
Wow, that is strange and different to the stack overflow question. I only pass the constraints down to Firebase so I don't have an idea right now what could be the problem. Could you try to access your collection without firestore_helpers and see if you get the same effect?
Tried to create new item from within app while it was showing filtered ones only (1 item only). This time it DID NOT push all items. Displayed items in app remained same as newly created item didn't match query constraints.
To test further i created another item which DID match with those constraints and this newly created item appeared in app as expected (2 item displayed total matching query constraints)
Now tried WITHOUT firestore_helpers and seems to work fine.
Stream
at first i get only 1 item as expected. Then in FB console manually changed random items and it didn't effect app. Then changed in another item city to be Paris , this time app got notification and and i got 2 items matching Paris city.
looks like there is bug in firestore_helpers
some more info. It seem to ONLY happen when i apply LocationsConstraint , with !LocationsConstraint it works fine
@miduch I tried to reproduce your issue without success. Can you try the lastest version v2.0.6 with cloud_firestore v0.8.0 ?
Actually the change you made was like it was in v2.0.3 and I changed there. As Query is an ancestor of CollectionReference this should not make any difference.
sorry it took a while to try out again. Issue is still reproduced with v 2.0.6 / 0.8.0
But when you change that one line it works? Could you try v 2.0.3 that should be the same. And please explain again the steps you do when doing this. Also show me your code where you call get data and where you define your constraints.
@miduch any new on this?
one line change: nope that was my mistake, as i thought it was having this issue with all request but later i realised that it happens ONLY when i use
List
Stream< List< Event > > getEvents({List
After this go to FB console and manually edit ANY item in collection (edit any field, doesn't need to be location). Stream in app will get all items from collection at this point
I tried and cannot reproduce it, sorry
I am using getDataFromQuery as shown in example, applying query constraints and getting results back as expected. But when in FB console I manually update any item, then I get all items instead of only those which I got after applying constraints in first place.
Thanks