'Firestore V9 Sorting Field by array of objects. Being shuffled on update

In my app, I have lists. these lists are categorized. Each category is stored into Firestore as a doc, along with an array of objects under that doc. The item Object contains {Name:'', Completed: ''}

When I update the "Completed" value (bool), my "onSnapshot" is triggered, but the Categories / lists are retrieved in a different order... How would I go about being able to order them? In time, the user will be able to sort, move the categories up/down themselves. So therefore I cannot hard-code a particular order that prevents the user from being able to sort those categories / lists themselves...

Here is the Firestore...

Firestore

onSnapshot...

enter image description here

the list View

enter image description here

And the function that deals with the Checkbox Click

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source