Skip to content

fix(mobile): ignore trashed assets in album date range and sorting qu…#30175

Open
tech00exploere wants to merge 1 commit into
immich-app:mainfrom
tech00exploere:fix/mobile-album-trashed-assets
Open

fix(mobile): ignore trashed assets in album date range and sorting qu…#30175
tech00exploere wants to merge 1 commit into
immich-app:mainfrom
tech00exploere:fix/mobile-album-trashed-assets

Conversation

@tech00exploere

Copy link
Copy Markdown
Contributor

Description

Fixes #30031

the mobile app was still including trashed assets when calculating an album's date range and when sorting albums by the latest or oldest photo. This made the album information on mobile different from the web, where trashed assets are already ignored.

this change updates the album queries in remote_album.repository.dart to filter out assets with a non-null deletedAt value. The existing query flow remains the same, with only the filtering condition added so that only active assets are considered.

this keeps the mobile behavior consistent with the server and web while limiting the change to the affected repository queries.

How Has This Been Tested?

->created an album with multiple assets and moved the newest asset to the Trash.
->verified that the album date range and sorting update correctly.
->moved the oldest asset to the Trash and verified that the album date range updates correctly.
->restored the trashed asset and verified that the album information updates correctly.
->verified that albums with all assets in the Trash still load correctly.
->verified that trashed assets are not shown as active album assets.

Screenshots (if appropriate)

N/A

Checklist:

  • I have carefully read CONTRIBUTING.md
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any Immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

I discussed the overall approach while investigating the issue. The implementation, testing, and final review were completed by me.

@immich-push-o-matic

immich-push-o-matic Bot commented Jul 23, 2026

Copy link
Copy Markdown

Label error. Requires exactly 1 of: changelog:.*. Found: 📱mobile. A maintainer will add the required label.

@tech00exploere

Copy link
Copy Markdown
Contributor Author

Hi! I looked into the issue and noticed that the server already excludes trashed assets from album summaries, while the mobile repository queries were still including them. My goal was to make the mobile behavior consistent with the web and server without changing the existing flow.
To keep the change as small as possible, I only added the deletedAt.isNull() filter to the relevant queries in remote_album.repository.dart so that only active assets are considered for album date range calculations, sorting, and asset retrieval.

I'd really appreciate it if you could review this approach. If there's a better place to handle this logic or if you think the implementation can be improved or simplified, I'd be happy to update the PR based on your suggestions. Thanks for taking a look!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: Trashed assets are still included in album date range and latest-photo sorting

2 participants