Search code examples
typescriptreact-tsxdaml

How can I order messages in the create-daml-app project in reverse chronological order?


I have been working on adding a few small UI features to the create-daml-app project (https://github.com/digital-asset/daml/tree/ba27ea9af4f39a9a3f307384e05f4bf540101f03/templates/create-daml-app). Specifically, I have added the direct messaging feature from the docs (https://docs.daml.com/getting-started/first-feature.html). The description there is excellent and it works well. By default, the messages are displayed in chronological order (first-sent to last-sent) and I would like to display them in reverse chronological order (last-sent to first-sent). Can someone help me do this?

Thank you.


Solution

  • Replace messagesResult.contracts with messagesResult.contracts.reverse().