diff --git a/cull/Services/PhotoImporter.swift b/cull/Services/PhotoImporter.swift --- a/cull/Services/PhotoImporter.swift +++ b/cull/Services/PhotoImporter.swift @@ -97,16 +97,18 @@ collected.append(result) } return collected } - // Apply on main actor - for (index, meta) in results { - let photo = photos[index] - photo.captureDate = meta.captureDate - photo.pixelWidth = meta.pixelWidth - photo.pixelHeight = meta.pixelHeight - photo.fileSize = meta.fileSize - photo.pairedPixelWidth = meta.pairedPixelWidth - photo.pairedPixelHeight = meta.pairedPixelHeight - photo.pairedFileSize = meta.pairedFileSize + // Apply metadata on main actor (@Observable Photo requires it) + await MainActor.run { + for (index, meta) in results { + let photo = photos[index] + photo.captureDate = meta.captureDate + photo.pixelWidth = meta.pixelWidth + photo.pixelHeight = meta.pixelHeight + photo.fileSize = meta.fileSize + photo.pairedPixelWidth = meta.pairedPixelWidth + photo.pairedPixelHeight = meta.pairedPixelHeight + photo.pairedFileSize = meta.pairedFileSize + } } } diff --git a/cull/Services/ShotGrouper.swift b/cull/Services/ShotGrouper.swift --- a/cull/Services/ShotGrouper.swift +++ b/cull/Services/ShotGrouper.swift @@ -147,8 +147,9 @@ let shouldMerge = areGroupsCloseInTime(previous, current) && areGroupsVisuallySimilar(previous, current, featurePrintMap: featurePrintMap) if shouldMerge { - // Merge into previous - previous.photos.append(contentsOf: current.photos) + // Build a new group with combined photos instead of mutating the existing one + let combined = PhotoGroup(photos: previous.photos + current.photos) + merged[merged.count - 1] = combined } else { merged.append(current) } diff --git a/cull/Services/ThumbnailCache.swift b/cull/Services/ThumbnailCache.swift --- a/cull/Services/ThumbnailCache.swift +++ b/cull/Services/ThumbnailCache.swift @@ -155,6 +155,7 @@ Task.detached(priority: .utility) { for batchStart in stride(from: 0, to: work.count, by: 8) { let batch = Array(work[batchStart..