Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(hidden):prevent-sidebar-from-closing

Aswin Asok2cf0d13c9ef3
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index eb6651ef7a..0551b26e10 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -336,6 +336,9 @@ export const Sidebar: React.FC<SidebarProps> = ({
if (!pendingAction) return;
void performSidebarActionRef
.current(pendingAction)
+ // Catch rejections (e.g., user dismissed auth) to prevent
+ // unhandled rejection errors from surfacing to the UI.
+ .catch(() => undefined)
.finally(() => onActionHandledRef.current?.(pendingAction));
}, [pendingAction]);
@@ -678,7 +681,9 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
void onShowCollectionSummary(PseudoCollectionID.hiddenItems, true)
// See: [Note: Workarounds for unactionable ARIA warnings]
.then(() => wait(10))
- .then(onCloseSidebar);
+ .then(onCloseSidebar)
+ // Catch rejection when user dismisses auth modal
+ .catch(() => undefined);
const summaryCaption = (summaryID: number) =>
normalCollectionSummaries.get(summaryID)?.fileCount.toString();
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index 7792acfa06..e9312a13ad 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -904,8 +904,11 @@ const Page: React.FC = () => {
lastAuthenticationForHiddenTimestamp.current = Date.now();
}
} catch (e) {
+ // Re-throw so the promise rejects and the sidebar stays open
+ // (the .then(ctx.onClose) chain in sidebar-search-registry
+ // won't execute on rejection).
log.info("Skipping navigation to hidden section", e);
- return;
+ throw e;
}
handleShowCollectionSummaryWithID(collectionSummaryID);
},