server: fix paging bug where p1->p2->p1 wouldn't show consistent results
This commit is contained in:
@@ -43,9 +43,13 @@ pub async fn search(
|
||||
query: &Query,
|
||||
) -> Result<Vec<(i32, ThreadSummary)>, async_graphql::Error> {
|
||||
info!("search({after:?} {before:?} {first:?} {last:?} {query:?}");
|
||||
let (offset, limit) = compute_offset_limit(after, before, first, last);
|
||||
// The +1 is to see if there are more pages of data available.
|
||||
let limit = limit + 1;
|
||||
let (offset, mut limit) = compute_offset_limit(after, before, first, last);
|
||||
if before.is_none() {
|
||||
// When searching forward, the +1 is to see if there are more pages of data available.
|
||||
// Searching backwards implies there's more pages forward, because the value represented by
|
||||
// `before` is on the next page.
|
||||
limit = limit + 1;
|
||||
}
|
||||
info!("search offset {offset} limit {limit}");
|
||||
|
||||
let rows = sqlx::query_file!(
|
||||
|
||||
Reference in New Issue
Block a user