From 733567d088b28d948e79422c7922f89620771de2 Mon Sep 17 00:00:00 2001 From: jubnl Date: Sat, 4 Apr 2026 18:58:34 +0200 Subject: [PATCH] fix(collabNotes): clear stale auth URL when switching photos (closes #403) Reset authUrl to empty string before fetching the new authenticated URL so the previous photo is never rendered during the async gap. Show a spinner while the new URL is loading. --- client/src/components/Collab/CollabNotes.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/components/Collab/CollabNotes.tsx b/client/src/components/Collab/CollabNotes.tsx index 0e449e3..fc197b9 100644 --- a/client/src/components/Collab/CollabNotes.tsx +++ b/client/src/components/Collab/CollabNotes.tsx @@ -3,7 +3,7 @@ import { useState, useEffect, useCallback, useRef, useMemo } from 'react' import DOM from 'react-dom' import Markdown from 'react-markdown' import remarkGfm from 'remark-gfm' -import { Plus, Trash2, Pin, PinOff, Pencil, X, Check, StickyNote, Settings, ExternalLink, Maximize2 } from 'lucide-react' +import { Plus, Trash2, Pin, PinOff, Pencil, X, Check, StickyNote, Settings, ExternalLink, Maximize2, Loader2 } from 'lucide-react' import { collabApi } from '../../api/client' import { getAuthUrl } from '../../api/authUrl' import { useCanDo } from '../../store/permissionsStore' @@ -100,6 +100,7 @@ function FilePreviewPortal({ file, onClose }: FilePreviewPortalProps) { const [authUrl, setAuthUrl] = useState('') const rawUrl = file?.url || '' useEffect(() => { + setAuthUrl('') if (!rawUrl) return getAuthUrl(rawUrl, 'download').then(setAuthUrl) }, [rawUrl]) @@ -119,7 +120,10 @@ function FilePreviewPortal({ file, onClose }: FilePreviewPortalProps) { {isImage ? ( /* Image lightbox — floating controls */
e.stopPropagation()}> - {file.original_name} + {authUrl + ? {file.original_name} + : + }
{file.original_name}