1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-21 18:16:55 +02:00

refactor(web): remove reactivity triggers (#14164)

This commit is contained in:
Michel Heusschen 2024-11-15 23:28:28 +01:00 committed by GitHub
parent caf6c0996d
commit 64a7baec8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 3 additions and 33 deletions

View File

@ -58,7 +58,6 @@
const handleToggle = (user: UserResponseDto) => { const handleToggle = (user: UserResponseDto) => {
if (Object.keys(selectedUsers).includes(user.id)) { if (Object.keys(selectedUsers).includes(user.id)) {
delete selectedUsers[user.id]; delete selectedUsers[user.id];
selectedUsers = selectedUsers;
} else { } else {
selectedUsers[user.id] = { user, role: AlbumUserRole.Editor }; selectedUsers[user.id] = { user, role: AlbumUserRole.Editor };
} }
@ -67,7 +66,6 @@
const handleChangeRole = (user: UserResponseDto, role: AlbumUserRole | 'none') => { const handleChangeRole = (user: UserResponseDto, role: AlbumUserRole | 'none') => {
if (role === 'none') { if (role === 'none') {
delete selectedUsers[user.id]; delete selectedUsers[user.id];
selectedUsers = selectedUsers;
} else { } else {
selectedUsers[user.id].role = role; selectedUsers[user.id].role = role;
} }

View File

@ -110,7 +110,6 @@
try { try {
await deleteActivity({ id: reaction.id }); await deleteActivity({ id: reaction.id });
reactions.splice(index, 1); reactions.splice(index, 1);
reactions = reactions;
if (isLiked && reaction.type === ReactionType.Like && reaction.id == isLiked.id) { if (isLiked && reaction.type === ReactionType.Like && reaction.id == isLiked.id) {
onDeleteLike(); onDeleteLike();
} else { } else {
@ -143,8 +142,6 @@
message = ''; message = '';
onAddComment(); onAddComment();
// Re-render the activity feed
reactions = reactions;
} catch (error) { } catch (error) {
handleError(error, $t('errors.unable_to_add_comment')); handleError(error, $t('errors.unable_to_add_comment'));
} finally { } finally {

View File

@ -90,7 +90,6 @@
for (const person of people) { for (const person of people) {
person.isHidden = personIsHidden[person.id]; person.isHidden = personIsHidden[person.id];
} }
people = people;
onClose(); onClose();
} catch (error) { } catch (error) {

View File

@ -101,15 +101,9 @@
const handleReset = (id: string) => { const handleReset = (id: string) => {
if (selectedPersonToReassign[id]) { if (selectedPersonToReassign[id]) {
delete selectedPersonToReassign[id]; delete selectedPersonToReassign[id];
// trigger reactivity
selectedPersonToReassign = selectedPersonToReassign;
} }
if (selectedPersonToCreate[id]) { if (selectedPersonToCreate[id]) {
delete selectedPersonToCreate[id]; delete selectedPersonToCreate[id];
// trigger reactivity
selectedPersonToCreate = selectedPersonToCreate;
} }
}; };

View File

@ -35,12 +35,10 @@
} }
selectedIds.add(option.value); selectedIds.add(option.value);
selectedIds = selectedIds;
}; };
const handleRemove = (tag: string) => { const handleRemove = (tag: string) => {
selectedIds.delete(tag); selectedIds.delete(tag);
selectedIds = selectedIds;
}; };
const onsubmit = (event: Event) => { const onsubmit = (event: Event) => {

View File

@ -112,7 +112,6 @@
assets.findIndex((a) => a.id === action.asset.id), assets.findIndex((a) => a.id === action.asset.id),
1, 1,
); );
assets = assets;
if (assets.length === 0) { if (assets.length === 0) {
await goto(AppRoute.PHOTOS); await goto(AppRoute.PHOTOS);
} else if (currentViewAssetIndex === assets.length) { } else if (currentViewAssetIndex === assets.length) {

View File

@ -7,7 +7,7 @@
export type SearchFilter = { export type SearchFilter = {
query: string; query: string;
queryType: 'smart' | 'metadata'; queryType: 'smart' | 'metadata';
personIds: Set<string>; personIds: SvelteSet<string>;
location: SearchLocationFilter; location: SearchLocationFilter;
camera: SearchCameraFilter; camera: SearchCameraFilter;
date: SearchDateFilter; date: SearchDateFilter;

View File

@ -9,9 +9,10 @@
import { handleError } from '$lib/utils/handle-error'; import { handleError } from '$lib/utils/handle-error';
import { t } from 'svelte-i18n'; import { t } from 'svelte-i18n';
import SingleGridRow from '$lib/components/shared-components/single-grid-row.svelte'; import SingleGridRow from '$lib/components/shared-components/single-grid-row.svelte';
import type { SvelteSet } from 'svelte/reactivity';
interface Props { interface Props {
selectedPeople: Set<string>; selectedPeople: SvelteSet<string>;
} }
let { selectedPeople = $bindable() }: Props = $props(); let { selectedPeople = $bindable() }: Props = $props();
@ -43,7 +44,6 @@
} else { } else {
selectedPeople.add(id); selectedPeople.add(id);
} }
selectedPeople = selectedPeople;
} }
const filterPeople = (list: PersonResponseDto[], name: string) => { const filterPeople = (list: PersonResponseDto[], name: string) => {

View File

@ -117,7 +117,6 @@
await updatePartner({ id: partner.user.id, updatePartnerDto: { inTimeline } }); await updatePartner({ id: partner.user.id, updatePartnerDto: { inTimeline } });
partner.inTimeline = inTimeline; partner.inTimeline = inTimeline;
partners = partners;
} catch (error) { } catch (error) {
handleError(error, $t('errors.unable_to_update_timeline_display_status')); handleError(error, $t('errors.unable_to_update_timeline_display_status'));
} }

View File

@ -35,7 +35,6 @@
} }
selectedAssetIds.add(suggestedAsset.id); selectedAssetIds.add(suggestedAsset.id);
selectedAssetIds = selectedAssetIds;
}); });
onDestroy(() => { onDestroy(() => {
@ -48,13 +47,10 @@
} else { } else {
selectedAssetIds.add(asset.id); selectedAssetIds.add(asset.id);
} }
selectedAssetIds = selectedAssetIds;
}; };
const onSelectNone = () => { const onSelectNone = () => {
selectedAssetIds.clear(); selectedAssetIds.clear();
selectedAssetIds = selectedAssetIds;
}; };
const onSelectAll = () => { const onSelectAll = () => {

View File

@ -35,8 +35,6 @@
person.updatedAt = Date.now().toString(); person.updatedAt = Date.now().toString();
} }
}); });
// trigger reactivity
people = people;
}); });
}); });
</script> </script>

View File

@ -74,9 +74,6 @@
person.updatedAt = new Date().toISOString(); person.updatedAt = new Date().toISOString();
} }
} }
// trigger reactivity
people = people;
}); });
}); });
@ -146,9 +143,6 @@
message: $t('change_name_successfully'), message: $t('change_name_successfully'),
type: NotificationType.Info, type: NotificationType.Info,
}); });
// trigger reactivity
people = people;
} catch (error) { } catch (error) {
handleError(error, $t('errors.unable_to_save_name')); handleError(error, $t('errors.unable_to_save_name'));
} }

View File

@ -156,8 +156,6 @@
searchResultAlbums.push(...albums.items); searchResultAlbums.push(...albums.items);
searchResultAssets.push(...assets.items); searchResultAssets.push(...assets.items);
searchResultAlbums = searchResultAlbums;
searchResultAssets = searchResultAssets;
nextPage = assets.nextPage ? Number(assets.nextPage) : null; nextPage = assets.nextPage ? Number(assets.nextPage) : null;
} catch (error) { } catch (error) {