Skip to content

Conversation

@krugerk
Copy link
Contributor

@krugerk krugerk commented Jan 11, 2026

Summary

Upon returning to the gallery, especially after bring the app back into the foreground, scrolling the gallery can be very choppy.
This PR reduces some of the lagginess by moving json serializing off of the main thread and by prefetching the gallery's thumbnails.

Validation

Used app in Simulator

#588 mentioned a slow gallery.

by serializing json off of the main thread
by prefetching gallery's thumbnails
@krugerk krugerk requested a review from a team as a code owner January 11, 2026 22:54
@krugerk krugerk requested review from theospears and removed request for a team January 11, 2026 22:54
Copy link
Collaborator

@theospears theospears left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this is needed! Added a few questions, but also happy to merge as-is if you think this is the best approach.

let goal = fetchedResultsController.object(at: indexPath)
return try? goal.thumbUrl.asURL()
}
let downloader = ImageDownloader.default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently GoalImageView has its own static ImageDownloader. Should we be either having this code use that downloader, or moving that to use the default one? I'm not sure if multiple instances share cache between them?

case .success(let data):
let asJSON = try? JSONSerialization.jsonObject(with: data)
return asJSON
case .success(let data): return try await Task.detached { try JSONSerialization.jsonObject(with: data) }.value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are your thoughts on this solution vs making RequestManager an actor so all its work is done on a background thread?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching it over to actor seems like a more complete solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants