fix: compute the /mangas total only on the first page
GET /mangas recomputed count(*) over FILTER_WHERE (up to five correlated subqueries) on every page, so pagination cost scaled with catalog size. The total doesn't change as a caller walks pages, so compute it once at offset 0 and return null thereafter (the envelope already serialises total as Option<i64>; the frontend types it number|null and the library route ignores it). Bump to 0.124.7. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -157,7 +157,9 @@ async fn list(
|
||||
order,
|
||||
};
|
||||
let (items, total) = repo::manga::list_cards(&state.db, &q).await?;
|
||||
Ok(Json(PagedResponse::with_total(items, limit, offset, total)))
|
||||
Ok(Json(PagedResponse::with_optional_total(
|
||||
items, limit, offset, total,
|
||||
)))
|
||||
}
|
||||
|
||||
async fn get_one(
|
||||
|
||||
Reference in New Issue
Block a user