fix(models): tolerate missing pagination fields in album page

/album/suggest returns a page with only {limit, items} (no total or
offset). SearchResultsPage required them, so the whole AlbumSuggestResponse
failed to deserialize and the album Suggestions carousel silently never
showed. Default the pagination scalars so only items is required.

cc
This commit is contained in:
vicrodh committed 2026-06-30 13:13:31 -06:00
1 parent 0ddcad40a6
commit 9e2a1d1266
1 file changed
+8
+8
View File
@@ -799,9 +799,17 @@ pub struct SearchResults {
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct SearchResultsPage<T> {
#[serde(default = "Vec::new")]
pub items: Vec<T>,
// `/album/suggest` returns a page with only `{limit, items}` (no `total`
// or `offset`); without defaults the whole response failed to deserialize
// and the album "Suggestions" carousel silently never showed. Defaulting
// the pagination scalars to 0 is harmless — only `items` is consumed there.
#[serde(default)]
pub total: u32,
#[serde(default)]
pub offset: u32,
#[serde(default)]
pub limit: u32,
}