π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(hidden):modal-closing-issue
Aswin Asoke4da32cbae73
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsxindex 5bd5110087..eb6651ef7a 100644--- a/web/apps/photos/src/components/Sidebar.tsx+++ b/web/apps/photos/src/components/Sidebar.tsx@@ -123,6 +123,7 @@ import React, {useCallback,useEffect,useMemo,+ useRef,useState,type MouseEventHandler,} from "react";@@ -318,12 +319,25 @@ export const Sidebar: React.FC<SidebarProps> = ({],);+ // Use refs for callbacks to prevent the effect from re-running when+ // callback identities change. This is critical because closing the auth+ // modal causes handleSidebarClose to get a new identity (it depends on+ // authenticateUserVisibilityProps.open), which cascades to+ // performSidebarAction, causing this effect to re-run while pendingAction+ // is still set - reopening the modal.+ const performSidebarActionRef = useRef(performSidebarAction);+ const onActionHandledRef = useRef(onActionHandled);+ useEffect(() => {+ performSidebarActionRef.current = performSidebarAction;+ onActionHandledRef.current = onActionHandled;+ });+useEffect(() => {if (!pendingAction) return;- void performSidebarAction(pendingAction).finally(() =>- onActionHandled?.(pendingAction),- );- }, [pendingAction, performSidebarAction, onActionHandled]);+ void performSidebarActionRef+ .current(pendingAction)+ .finally(() => onActionHandledRef.current?.(pendingAction));+ }, [pendingAction]);return (<RootSidebarDrawer open={open} onClose={onClose}>diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 85f6d1bbe7..7792acfa06 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -269,6 +269,11 @@ const Page: React.FC = () => {sidebarVisibilityProps.onClose();}, [authenticateUserVisibilityProps.open, sidebarVisibilityProps.onClose]);+ const handleSidebarActionHandled = useCallback(+ () => setPendingSidebarAction(undefined),+ [],+ );+// Local aliases.const {user,@@ -1186,7 +1191,7 @@ const Page: React.FC = () => {state.uncategorizedCollectionSummaryID}pendingAction={pendingSidebarAction}- onActionHandled={() => setPendingSidebarAction(undefined)}+ onActionHandled={handleSidebarActionHandled}onShowPlanSelector={showPlanSelector}onShowCollectionSummary={handleSidebarShowCollectionSummary}onShowExport={showExport}