Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions mobile/lib/pages/common/gallery_viewer.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,6 @@ class GalleryViewerPage extends HookConsumerWidget {
PhotoViewGalleryPageOptions buildAsset(BuildContext context, int index) {
var newAsset = loadAsset(index);

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

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:

ref.read(currentAssetProvider.notifier).set(newAsset);
});

final stackId = newAsset.stackId;
if (stackId != null && currentIndex.value == index) {
final stackElements =
Expand Down
5 changes: 5 additions & 0 deletions mobile/lib/widgets/asset_viewer/bottom_gallery_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ class BottomGalleryBar extends ConsumerWidget {

totalAssets.value -= 1;
}
if (isDeleted) {
ref
.read(currentAssetProvider.notifier)
.set(renderList.loadAsset(assetIndex.value));
}
return isDeleted;
}

Expand Down
Loading