From ff7e30794b7c79c3aa237dde33f52e716703c434 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Wed, 20 Mar 2024 13:01:36 +0100 Subject: [PATCH] gui: sort events and txs after push in the list when a pending tx is confirmed, it is pushed in the HistoryTransaction list at the end. It should be first in the list. We sort now the list in order to make sure it will be always the case. --- gui/src/app/state/mod.rs | 1 + gui/src/app/state/transactions.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/gui/src/app/state/mod.rs b/gui/src/app/state/mod.rs index 0a0bc154..cc10b932 100644 --- a/gui/src/app/state/mod.rs +++ b/gui/src/app/state/mod.rs @@ -180,6 +180,7 @@ impl State for Home { self.events.push(event); } } + self.events.sort_by(|a, b| b.time.cmp(&a.time)); } }, Message::PendingTransactions(res) => match res { diff --git a/gui/src/app/state/transactions.rs b/gui/src/app/state/transactions.rs index 903defad..e66a6e7c 100644 --- a/gui/src/app/state/transactions.rs +++ b/gui/src/app/state/transactions.rs @@ -100,6 +100,7 @@ impl State for TransactionsPanel { self.txs.push(tx); } } + self.txs.sort_by(|a, b| b.time.cmp(&a.time)); } }, Message::PendingTransactions(res) => match res {