π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Keep public feed thumbnails across refreshes
Anand Baburajan0619f29cc141
diff --git a/web/apps/albums/src/public-album/viewer/components/PublicFeedSidebar.tsx b/web/apps/albums/src/public-album/viewer/components/PublicFeedSidebar.tsxindex a0287e7637..ec8b5d27ef 100644--- a/web/apps/albums/src/public-album/viewer/components/PublicFeedSidebar.tsx+++ b/web/apps/albums/src/public-album/viewer/components/PublicFeedSidebar.tsx@@ -656,11 +656,23 @@ export const PublicFeedSidebar: React.FC<PublicFeedSidebarProps> = ({const [isLoading, setIsLoading] = useState(false);const thumbnailCacheRef = useRef(thumbnailCache);const thumbnailLoadsInFlightRef = useRef<Set<number>>(new Set());+ const canSetThumbnailCacheRef = useRef(open);useEffect(() => {thumbnailCacheRef.current = thumbnailCache;}, [thumbnailCache]);+ useEffect(() => {+ canSetThumbnailCacheRef.current = open;+ }, [open]);++ useEffect(+ () => () => {+ canSetThumbnailCacheRef.current = false;+ },+ [],+ );+// Build file type cache from filesuseEffect(() => {const cache = new Map<number, number>();@@ -675,8 +687,6 @@ export const PublicFeedSidebar: React.FC<PublicFeedSidebarProps> = ({useEffect(() => {if (!open || (comments.length === 0 && reactions.length === 0)) return;- let didCancel = false;-const fileIDsWithActivity = new Set<number>();for (const c of comments) {@@ -706,7 +716,7 @@ export const PublicFeedSidebar: React.FC<PublicFeedSidebarProps> = ({try {const url =await downloadManager.renderableThumbnailURL(file);- if (didCancel || !url) return;+ if (!url || !canSetThumbnailCacheRef.current) return;setThumbnailCache((prev) => {if (prev.get(file.id) === url) return prev;@@ -726,10 +736,6 @@ export const PublicFeedSidebar: React.FC<PublicFeedSidebarProps> = ({}}),);-- return () => {- didCancel = true;- };}, [open, comments, reactions, files]);// Polling interval for refreshing feed data (5 seconds)