diff --git a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx index 324928e9e6..5a17f43d17 100644 --- a/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx +++ b/web/apps/photos/src/components/PhotoViewer/FileInfo/index.tsx @@ -96,8 +96,6 @@ export function FileInfo({ const [parsedExifData, setParsedExifData] = useState>(); const [showExif, setShowExif] = useState(false); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [updateMLDataIndex, setUpdateMLDataIndex] = useState(0); const openExif = () => setShowExif(true); const closeExif = () => setShowExif(false); @@ -332,14 +330,8 @@ export function FileInfo({ {appContext.mlSearchEnabled && ( <> - {/* */} - + {/* */} + )} diff --git a/web/apps/photos/src/components/ml/PeopleList.tsx b/web/apps/photos/src/components/ml/PeopleList.tsx index 26c5c80556..def73dffd5 100644 --- a/web/apps/photos/src/components/ml/PeopleList.tsx +++ b/web/apps/photos/src/components/ml/PeopleList.tsx @@ -66,35 +66,29 @@ export const PeopleList = React.memo((props: PeopleListProps) => { export interface PhotoPeopleListProps extends PeopleListPropsBase { file: EnteFile; - updateMLDataIndex: number; } export function PhotoPeopleList() { return <>; } -export function UnidentifiedFaces(props: { - file: EnteFile; - updateMLDataIndex: number; -}) { +export function UnidentifiedFaces({ file }: { file: EnteFile }) { const [faces, setFaces] = useState<{ id: string }[]>([]); useEffect(() => { let didCancel = false; - async function updateFaceImages() { - const faces = await getUnidentifiedFaces(props.file); + (async () => { + const faces = await unidentifiedFaceIDs(file); !didCancel && setFaces(faces); - } - - updateFaceImages(); + })(); return () => { didCancel = true; }; - }, [props.file, props.updateMLDataIndex]); + }, [file]); - if (!faces || faces.length === 0) return <>; + if (faces.length == 0) return <>; return ( <> @@ -102,12 +96,11 @@ export function UnidentifiedFaces(props: { {t("UNIDENTIFIED_FACES")} - {faces && - faces.map((face, index) => ( - - - - ))} + {faces.map((face) => ( + + + + ))} ); @@ -151,10 +144,9 @@ const FaceCropImageView: React.FC = ({ faceID }) => { ); }; -async function getUnidentifiedFaces(file: EnteFile): Promise<{ id: string }[]> { +const unidentifiedFaceIDs = async ( + file: EnteFile, +): Promise<{ id: string }[]> => { const mlFileData = await mlIDbStorage.getFile(file.id); - - return mlFileData?.faces?.filter( - (f) => f.personId === null || f.personId === undefined, - ); -} + return mlFileData?.faces; +};