Skip to content

armgit / ente

Public Imported from GitHub
0

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

chore(gallery):added-try-catch-loading-to-the-handleAddPersonSelectedFiles

Aswin Asok138f2d5cae6b
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index a26743560e..b8d1d3e269 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -949,20 +949,29 @@ const Page: React.FC = () => {
const handleAddPersonToSelectedFiles = useCallback(
async (personID: string) => {
- const selectedFiles = getSelectedFiles(selected, filteredFiles);
- await addManualFileAssignmentsToPerson(
- personID,
- selectedFiles.map((f) => f.id),
- );
- clearSelection();
- const personName = namedPeople.find((p) => p.id === personID)?.name;
- showNotification({
- color: "secondary",
- startIcon: <CheckCircleIcon />,
- title: t("added_to_person"),
- caption: personName,
- autoHideDuration: 3000,
- });
+ showLoadingBar();
+ try {
+ const selectedFiles = getSelectedFiles(selected, filteredFiles);
+ await addManualFileAssignmentsToPerson(
+ personID,
+ selectedFiles.map((f) => f.id),
+ );
+ clearSelection();
+ const personName = namedPeople.find(
+ (p) => p.id === personID,
+ )?.name;
+ showNotification({
+ color: "secondary",
+ startIcon: <CheckCircleIcon />,
+ title: t("added_to_person"),
+ caption: personName,
+ autoHideDuration: 3000,
+ });
+ } catch (e) {
+ onGenericError(e);
+ } finally {
+ hideLoadingBar();
+ }
},
[
selected,
@@ -970,6 +979,9 @@ const Page: React.FC = () => {
clearSelection,
showNotification,
namedPeople,
+ showLoadingBar,
+ hideLoadingBar,
+ onGenericError,
],
);