Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fin

Manav Rathi58ce181a405b
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index e48c344f28..b9ead88ba2 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -26,19 +26,6 @@ export type FileListWithViewerProps = {
*/
files: EnteFile[];
enableDownload?: boolean;
- /**
- * Called when the component wants to update the in-memory, unsynced,
- * favorite status of a file.
- *
- * For more details, see {@link unsyncedFavoriteUpdates} in the gallery
- * reducer's documentation.
- *
- * Not set in the context of the shared albums app.
- */
- onMarkUnsyncedFavoriteUpdate?: (
- fileID: number,
- isFavorite: boolean,
- ) => void;
/**
* Called when the component wants to mark the given files as deleted in the
* the in-memory, unsynced, state maintained by the top level gallery.
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 76a3dbb474..cd7d368510 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -834,7 +834,7 @@ const Page: React.FC = () => {
dispatch({
type: "unsyncedFavoriteUpdate",
fileID,
- isFavorite,
+ isFavorite: !isFavorite,
});
} finally {
dispatch({ type: "removePendingFavoriteUpdate", fileID });
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 2cf7116942..ba8bebe24b 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -614,27 +614,16 @@ export class FileViewerPhotoSwipe {
let favoriteButtonElement: HTMLButtonElement | undefined;
- const toggleFavorite = async () => {
- // updateFavoriteButtonIfNeeded();
- await delegate.toggleFavorite(currentAnnotatedFile());
- // updateFavoriteButtonIfNeeded();
- };
+ const toggleFavorite = () =>
+ delegate.toggleFavorite(currentAnnotatedFile());
const updateFavoriteButtonIfNeeded = () => {
const favoriteIconFill = document.getElementById(
"pswp__icn-favorite-fill",
);
- console.log("updateFavoriteButtonIfNeeded", {
- favoriteIconFill,
- isFavorite: delegate.isFavoritePending(currentAnnotatedFile()),
- isFavoritePending: delegate.isFavoritePending(
- currentAnnotatedFile(),
- ),
- });
if (!favoriteIconFill) {
- // Need a null check since we might've been closed meanwhile on
- // the code path where we're called after the async operation in
- // `toggleFavorite`.
+ // Early return if we're not currently being shown, to implement
+ // the "IfNeeded" semantics.
return;
}