Skip to content

fix: update renderlist after asset deleted #16786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2025

Conversation

Saschl
Copy link
Contributor

@Saschl Saschl commented Mar 10, 2025

Description

#15597 contains a change that fixes the deletion of a single asset (previously the app correctly showed the following image, but in the background the old image was still referenced). However, as it was correctly pointed out, this change would also set the new asset on every little swipe, which could also lead to incorrect behaviour.

I have now moved the logic to a (in my view) more appropriate place, where it only applies when an image is being deleted.

Fixes #17193

How Has This Been Tested?

  • Open an image in the gallery, and delete it. Immich should show the next image. Delete this one as well. Deletion should succeed and Immich should go to the next image.

Screenshots (if appropriate)

Checklist:

  • 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/)

@@ -263,10 +263,6 @@ class GalleryViewerPage extends HookConsumerWidget {
PhotoViewGalleryPageOptions buildAsset(BuildContext context, int index) {
var newAsset = loadAsset(index);

WidgetsBinding.instance.addPostFrameCallback((_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this logic is removed, would any logic in the currentAssetProvider won't be using the correct asset when navigating between them?

Copy link
Contributor Author

@Saschl Saschl Mar 11, 2025

Choose a reason for hiding this comment

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

I believe this is handled by the onpagechanged callback which is called when swiping through the images, but not after an asset has been trashed/deleted:

@Saschl Saschl requested a review from alextran1502 March 17, 2025 22:51
@Saschl
Copy link
Contributor Author

Saschl commented Mar 25, 2025

Just a small demonstration how the current implementation can cause issues. When swiping a bit and the hitting delete, the wrong image is being trashed.

Screenrecorder-2025-03-25-15-37-44-783.mp4

Copy link
Contributor

@mertalev mertalev left a comment

Choose a reason for hiding this comment

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

Thank you for the fix!

@mertalev mertalev enabled auto-merge (squash) March 28, 2025 18:26
@mertalev mertalev merged commit 6419ac7 into immich-app:main Mar 28, 2025
45 checks passed
kirill-dev-pro pushed a commit to kirill-dev-pro/immich-but-with-public-albums-within-instance that referenced this pull request Apr 6, 2025
savely-krasovsky pushed a commit to savely-krasovsky/immich that referenced this pull request Jun 8, 2025
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.

Video player on iOS will misbehave when navigating via swipes
4 participants