Refresh the collection tree when a sync brings membership
New-York gained 127 photographs from the tablet and the sidebar went on showing no number beside it. Two reasons, and the second is why the first was never noticed. The sync's completion handler reloads the grid and never rebuilds the tree — the scan already does, and the sync merges the same tables. And the condition it reloads under was `collections_gained > 0`, which counts collections, not members: a sync that files 127 photographs into a collection both devices already had gains no collection at all, so the count was zero and nothing refreshed. `SyncReport` now carries `members_gained` from the merge report, and either one rebuilds the tree. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,13 @@ pub struct SyncReport {
|
||||
pub catalog_uploaded: bool,
|
||||
pub catalog_merged: bool,
|
||||
pub collections_gained: usize,
|
||||
/// Membership rows the merge brought in (FR-CAT-7).
|
||||
///
|
||||
/// Counted apart from `collections_gained`, which counts the collections
|
||||
/// themselves. A sync that files 127 photographs into a collection both
|
||||
/// devices already had gains *no* collection, and reporting only the
|
||||
/// former left the sidebar showing no count beside a full collection.
|
||||
pub members_gained: usize,
|
||||
}
|
||||
|
||||
impl SyncReport {
|
||||
@@ -334,6 +341,7 @@ async fn sync_catalog(
|
||||
Ok(merge) => {
|
||||
report.catalog_merged = true;
|
||||
report.collections_gained = merge.inserted + merge.updated;
|
||||
report.members_gained = merge.members_added;
|
||||
}
|
||||
Err(e) => log::warn!("merging remote catalog: {e}"),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user