Dictionaries are ordered on both the client and the server but it looks like passing the dictionary from client to server does not guarantee order.
Since portable_classes you can come up with your own serialization and keep the order.
import anvil.server
@anvil.server.portable_class
class odict(dict):
def __serialize__(self, global_data):
return list(self.items())
def __deserialize__(self, data, global_data):
self.__init__(data)
Here’s proof of concept
https://anvil.works/build#clone:XN3TIGKFYZRMZKFI=FSCEFHEZQ37H2YJRPCZMQBRZ