From 2507eed6a2a88ca6b278adbbde4e7d33545bf8d0 Mon Sep 17 00:00:00 2001 From: Maxime Van Hees Date: Thu, 25 Jul 2024 13:42:06 +0200 Subject: [PATCH] Jump back to first page when sorting on a column --- mycelium-ui/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mycelium-ui/src/main.rs b/mycelium-ui/src/main.rs index 76f004e..84a5fcf 100644 --- a/mycelium-ui/src/main.rs +++ b/mycelium-ui/src/main.rs @@ -282,6 +282,7 @@ fn PeersTable(peers: Vec) -> Element { ); }; + // Sorting let mut sort_peers_signal = move |column: String| { if column == *sort_column.read() { let new_sort_direction = match *sort_direction.read() { @@ -293,6 +294,8 @@ fn PeersTable(peers: Vec) -> Element { sort_column.set(column); sort_direction.set(SortDirection::Descending); } + // When sorting, we should jump back to the first page + current_page.set(0); }; let sorted_peers = use_memo(move || { @@ -496,6 +499,8 @@ fn RoutesTable(routes: Vec, table_name: String) -> Element sort_column.set(column); sort_direction.set(SortDirection::Ascending); } + // When sorting, we should jump back to the first page + current_page.set(0); }; let sorted_routes = use_memo(move || {