From 3aa0b94db4057edc855a345b1e2eaab2d496a92b Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Mon, 22 Jul 2024 08:13:19 -0700 Subject: [PATCH] Fix bug in pagination when more than SEARCH_RESULTS_PER_PAGE returned --- web/src/view/mod.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/web/src/view/mod.rs b/web/src/view/mod.rs index 5dbc89d..0937cec 100644 --- a/web/src/view/mod.rs +++ b/web/src/view/mod.rs @@ -12,7 +12,6 @@ use seed_hooks::{state_access::CloneState, topo, use_state}; use crate::{ api::urls, - consts::SEARCH_RESULTS_PER_PAGE, graphql::{front_page_query::*, show_thread_query::*}, state::{unread_query, Model, Msg, RefreshingState}, }; @@ -308,7 +307,14 @@ fn search_toolbar( .start_cursor .as_ref() .map(|i| i.parse().unwrap_or(0)) - .unwrap_or(0); + .unwrap_or(0) + + 1; + let end = pager + .end_cursor + .as_ref() + .map(|i| i.parse().unwrap_or(count)) + .unwrap_or(count) + + 1; nav![ C!["level", "is-mobile"], IF!(show_bulk_edit => @@ -377,12 +383,7 @@ fn search_toolbar( ], ul![ C!["pagination-list"], - li![format!( - "{} - {} of {}", - start, - count.min(start + SEARCH_RESULTS_PER_PAGE), - count - )], + li![format!("{} - {} of {}", start, end, count)], ], ] ]