From 13f406d80ba9d7e8ceb75aff57a7a99cbc38c279 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 28 Dec 2024 16:21:49 +0100 Subject: [PATCH] feat(server): refactored for better readability --- web/src/routes/(user)/people/+page.svelte | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/web/src/routes/(user)/people/+page.svelte b/web/src/routes/(user)/people/+page.svelte index 606b43edadd0e..8b6d77db88bad 100644 --- a/web/src/routes/(user)/people/+page.svelte +++ b/web/src/routes/(user)/people/+page.svelte @@ -230,12 +230,8 @@ personUpdateDto: { isFavorite: !detail.isFavorite }, }); - people = people.map((person: PersonResponseDto) => { - if (person.id === updatedPerson.id) { - return updatedPerson; - } - return person; - }); + const index = people.findIndex((person) => person.id === detail.id); + people[index] = updatedPerson; notificationController.show({ message: updatedPerson.isFavorite ? $t('added_to_favorites') : $t('removed_from_favorites'),