You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we click on the image whose path no longer exist the UI in MediaView.tsx flickers.
Steps to reproduce the Bug
Before launching the PictoPy app (backend/sync/frontend), delete a folder that has already been added to PictoPy.
Launch the PictoPy application.
Navigate to the Home section (or any gallery view).
Images from the deleted folder may still appear because thumbnail paths are still there. (This behavior is acceptable.)
Click on one of these images.
Observe that the UI flickers instead of handling the missing image.
Expected Behaviour
When an image file is missing or its path is invalid:
The UI should not flicker
A clear message should be shown (e.g., “Image not found” or “File unavailable”)
Actual Behavior
The UI flickers when attempting to open an image whose file path is invalid.
Implementation (ImageViewer.tsx)
State-Driven Error Tracking
const[hasError,setHasError]=React.useState(false);// Reset error state when imagePath changes (e.g., user clicks Next)React.useEffect(()=>{setHasError(false);},[imagePath]);
Conditional Rendering (The Fix)
<imgsrc={convertFileSrc(imagePath)}onError={(e)=>{console.log("qwertyuiop")// Printed foreverconstimg=e.targetasHTMLImageElement;img.src='/placeholder.svg';// Triggered error again if svg was missing}}/>
Displaying message
{hasError ? (// Show a polished fallback UI instead of a broken image<divclassName="flex flex-col items-center ..."><ImageOffclassName="h-24 w-24 ..."/><p>Image could not be loaded</p></div>) : (<imgsrc={convertFileSrc(imagePath)}onError={()=>setHasError(true)}// Set state once, React removes the <img>className="..."/>)}
Is there an existing issue for this?
What happened?
Description
When we click on the image whose path no longer exist the UI in
MediaView.tsxflickers.Steps to reproduce the Bug
(This behavior is acceptable.)
Expected Behaviour
Actual Behavior
Implementation (ImageViewer.tsx)
Screen Recordings
Before
2026-02-19.21-27-00.mp4
After
2026-02-19.21-44-42.mp4
Record