-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
@@ -263,10 +263,6 @@ class GalleryViewerPage extends HookConsumerWidget { | |||
PhotoViewGalleryPageOptions buildAsset(BuildContext context, int index) { | |||
var newAsset = loadAsset(index); | |||
|
|||
WidgetsBinding.instance.addPostFrameCallback((_) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
onPageChanged: (value) { |
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 |
There was a problem hiding this 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!
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?
Screenshots (if appropriate)
Checklist:
src/services/
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/
)