Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Make it work when deleting the last slide in the list

Manav Rathi43ce9edb9555
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 13b590d206..f26d566f29 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -1420,14 +1420,13 @@ export class FileViewerPhotoSwipe {
};
if (this.pswp.currIndex >= newFileCount) {
- // If the last slide was removed, go back to the beginning (the code
+ // If the last slide was removed, take one step back first (the code
// that calls us ensures that we don't get called if there are no
// more slides left).
- this.pswp.goTo(0);
- refreshSlideAndNextNeighbour(0);
- } else {
- refreshSlideAndNextNeighbour(this.pswp.currIndex);
+ this.pswp.prev();
}
+
+ refreshSlideAndNextNeighbour(this.pswp.currIndex);
}
/**