Skip to content

armgit / ente

Public Imported from GitHub
0

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

refractor(Sidebar):removed-onClose-of-hidden-modal-from-registry

Aswin Asokc5c1dbbdc541
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index 0551b26e10..eb6651ef7a 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -336,9 +336,6 @@ 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]);
@@ -681,9 +678,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
void onShowCollectionSummary(PseudoCollectionID.hiddenItems, true)
// See: [Note: Workarounds for unactionable ARIA warnings]
.then(() => wait(10))
- .then(onCloseSidebar)
- // Catch rejection when user dismisses auth modal
- .catch(() => undefined);
+ .then(onCloseSidebar);
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 e9312a13ad..1ccea11e81 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -265,9 +265,8 @@ const Page: React.FC = () => {
}, [authenticateUserVisibilityProps.onClose]);
const handleSidebarClose = useCallback(() => {
- if (authenticateUserVisibilityProps.open) return;
sidebarVisibilityProps.onClose();
- }, [authenticateUserVisibilityProps.open, sidebarVisibilityProps.onClose]);
+ }, [sidebarVisibilityProps.onClose]);
const handleSidebarActionHandled = useCallback(
() => setPendingSidebarAction(undefined),
@@ -894,22 +893,16 @@ const Page: React.FC = () => {
isHiddenCollectionSummary: boolean | undefined,
) => {
const lastAuthAt = lastAuthenticationForHiddenTimestamp.current;
- try {
- if (
- isHiddenCollectionSummary &&
- barMode != "hidden-albums" &&
- Date.now() - lastAuthAt > 5 * 60 * 1e3 /* 5 minutes */
- ) {
- await authenticateUser();
- 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);
- throw e;
+
+ if (
+ isHiddenCollectionSummary &&
+ barMode != "hidden-albums" &&
+ Date.now() - lastAuthAt > 5 * 60 * 1e3 /* 5 minutes */
+ ) {
+ await authenticateUser();
+ lastAuthenticationForHiddenTimestamp.current = Date.now();
}
+
handleShowCollectionSummaryWithID(collectionSummaryID);
},
[authenticateUser, handleShowCollectionSummaryWithID, barMode],
diff --git a/web/packages/new/photos/services/search/sidebar-search-registry.ts b/web/packages/new/photos/services/search/sidebar-search-registry.ts
index d5c7c36c14..d180f48025 100644
--- a/web/packages/new/photos/services/search/sidebar-search-registry.ts
+++ b/web/packages/new/photos/services/search/sidebar-search-registry.ts
@@ -117,6 +117,7 @@ const sidebarActions = (): SidebarAction[] => {
label: t("export_data"),
path: [preferencesCategory, t("export_data")],
keywords: ["export", "download"],
+ available: () => isDesktop,
},
{
id: "utility.logout",
@@ -298,7 +299,6 @@ export const performSidebarAction = async (
.onShowCollectionSummary(ctx.pseudoIDs.hidden, true)
// See: [Note: Workarounds for unactionable ARIA warnings]
.then(() => wait(10))
- .then(ctx.onClose)
);
case "shortcuts.trash":
return ctx