diff --git a/web/src/lib/components/faces-page/person-side-panel.svelte b/web/src/lib/components/faces-page/person-side-panel.svelte index 46f63fbed..2fb37f0cf 100644 --- a/web/src/lib/components/faces-page/person-side-panel.svelte +++ b/web/src/lib/components/faces-page/person-side-panel.svelte @@ -16,7 +16,6 @@ import { photoViewer } from '$lib/stores/assets.store'; import UnassignedFacesSidePannel from './unassigned-faces-side-pannel.svelte'; import type { FaceWithGeneretedThumbnail } from '$lib/utils/people-utils'; - import { cloneDeep } from 'lodash-es'; export let assetId: string; @@ -29,10 +28,9 @@ let selectedPersonToReassign: (PersonResponseDto | null)[]; let selectedPersonToCreate: (string | null)[]; let selectedPersonToAdd: FaceWithGeneretedThumbnail[] = []; - let selectedPersonToUnassign: AssetFaceResponseDto[] = []; + let selectedPersonToUnassign: FaceWithGeneretedThumbnail[] = []; let selectedPersonToRemove: boolean[] = []; let unassignedFaces: (FaceWithGeneretedThumbnail | null)[] = []; - let unassignedFacesOriginal: (FaceWithGeneretedThumbnail | null)[] = []; let editedPersonIndex: number; let shouldRefresh: boolean = false; @@ -94,7 +92,6 @@ } }), ); - unassignedFacesOriginal = cloneDeep(unassignedFaces); } catch (error) { handleError(error, "Can't get faces"); } finally { @@ -163,7 +160,8 @@ if (selectedPersonToRemove[i]) { const image = await zoomImageToBase64(peopleWithFaces[i], $photoViewer); if (image) { - selectedPersonToUnassign.push(peopleWithFaces[i]); + selectedPersonToUnassign.push({ ...peopleWithFaces[i], customThumbnail: image }); + // Trigger reactivity selectedPersonToUnassign = selectedPersonToUnassign; if (selectedPersonToReassign[i]) { selectedPersonToReassign[i] = null; @@ -183,8 +181,6 @@ const handleEditFaces = async () => { loaderLoadingDoneTimeout = setTimeout(() => (isShowLoadingDone = true), 100); - const uniqueIds = new Set(unassignedFacesOriginal.map((objA) => objA && objA.id)); - selectedPersonToUnassign = selectedPersonToUnassign.filter((objB) => !uniqueIds.has(objB.id)); const numberOfChanges = selectedPersonToCreate.filter((person) => person !== null).length + @@ -267,8 +263,6 @@ const handleCreateOrReassignFaceFromUnassignedFace = (face: FaceWithGeneretedThumbnail) => { selectedPersonToAdd.push(face); - const uniqueIds = new Set(selectedPersonToAdd.map((objA) => objA.id)); - selectedPersonToUnassign = selectedPersonToUnassign.filter((objB) => !uniqueIds.has(objB.id)); selectedPersonToAdd = selectedPersonToAdd; showUnassignedFaces = false; }; @@ -336,7 +330,7 @@
- {face.person?.name} -
{/if} - {#if !isSelectingFaces} -Faces to add
++ {face.person?.name} +
{/if} + {#if !isSelectingFaces} +- {face.person?.name} -
{/if} - {#if !isSelectingFaces} -Faces to unassign
++ {face.person?.name} +
{/if} + {#if !isSelectingFaces} +Faces Available
+Faces available