Closed JayPerfetto closed 4 years ago
Can you try putting the query in a variable and then having the whole query change instead of just the field? The library already supports changes like this but seems likely that the change isn't being caught, so it doesn't refresh the whole query.
I think you're misunderstanding the issue - for context - this is used in a messaging app. The list of threads should be ordered by updatedDate, and each thread's updated date gets set to Timestamp.now() whenever a new message is sent to that thread.
When this happens, I would expect a query that includes .orderBy('updatedAt') to re-order, based on the new timestamp. I am seeing instead that value displayed in the UI for each thread change, but the order of the list does not. After hard-reloading the app, the order of the list is updated to be correct.
Does this make sense?
Ah, for messaging I recommend turning on the linear: true
parameter, that makes it so the list uses .add
instead of .insert
which is known to mess up lists like this. Let me know if that helps! If not, then it might be something that changed on cloud_firestore
.
I also tried toggling this param with no avail - I tested this every way I could think of, using a locator for my firestore instance, turning firestore persistence off, creating indices for the queries, you name it.
My workaround has been to create a listview within a streambuilder - with the same query it works as desired, just without the elegant animation
I have a list with the following query: query: locator()
.collection('someCollection')
.orderBy('updatedAt', descending: true),
When the field 'updatedAt' changes, the order of the list does not change such that the most recent is at the top. This field is a firestore Timestamp type.