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:
parent
caf6c0996d
commit
64a7baec8c
@ -58,7 +58,6 @@
|
||||
const handleToggle = (user: UserResponseDto) => {
|
||||
if (Object.keys(selectedUsers).includes(user.id)) {
|
||||
delete selectedUsers[user.id];
|
||||
selectedUsers = selectedUsers;
|
||||
} else {
|
||||
selectedUsers[user.id] = { user, role: AlbumUserRole.Editor };
|
||||
}
|
||||
@ -67,7 +66,6 @@
|
||||
const handleChangeRole = (user: UserResponseDto, role: AlbumUserRole | 'none') => {
|
||||
if (role === 'none') {
|
||||
delete selectedUsers[user.id];
|
||||
selectedUsers = selectedUsers;
|
||||
} else {
|
||||
selectedUsers[user.id].role = role;
|
||||
}
|
||||
|
@ -110,7 +110,6 @@
|
||||
try {
|
||||
await deleteActivity({ id: reaction.id });
|
||||
reactions.splice(index, 1);
|
||||
reactions = reactions;
|
||||
if (isLiked && reaction.type === ReactionType.Like && reaction.id == isLiked.id) {
|
||||
onDeleteLike();
|
||||
} else {
|
||||
@ -143,8 +142,6 @@
|
||||
|
||||
message = '';
|
||||
onAddComment();
|
||||
// Re-render the activity feed
|
||||
reactions = reactions;
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_add_comment'));
|
||||
} finally {
|
||||
|
@ -90,7 +90,6 @@
|
||||
for (const person of people) {
|
||||
person.isHidden = personIsHidden[person.id];
|
||||
}
|
||||
people = people;
|
||||
|
||||
onClose();
|
||||
} catch (error) {
|
||||
|
@ -101,15 +101,9 @@
|
||||
const handleReset = (id: string) => {
|
||||
if (selectedPersonToReassign[id]) {
|
||||
delete selectedPersonToReassign[id];
|
||||
|
||||
// trigger reactivity
|
||||
selectedPersonToReassign = selectedPersonToReassign;
|
||||
}
|
||||
if (selectedPersonToCreate[id]) {
|
||||
delete selectedPersonToCreate[id];
|
||||
|
||||
// trigger reactivity
|
||||
selectedPersonToCreate = selectedPersonToCreate;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -35,12 +35,10 @@
|
||||
}
|
||||
|
||||
selectedIds.add(option.value);
|
||||
selectedIds = selectedIds;
|
||||
};
|
||||
|
||||
const handleRemove = (tag: string) => {
|
||||
selectedIds.delete(tag);
|
||||
selectedIds = selectedIds;
|
||||
};
|
||||
|
||||
const onsubmit = (event: Event) => {
|
||||
|
@ -112,7 +112,6 @@
|
||||
assets.findIndex((a) => a.id === action.asset.id),
|
||||
1,
|
||||
);
|
||||
assets = assets;
|
||||
if (assets.length === 0) {
|
||||
await goto(AppRoute.PHOTOS);
|
||||
} else if (currentViewAssetIndex === assets.length) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
export type SearchFilter = {
|
||||
query: string;
|
||||
queryType: 'smart' | 'metadata';
|
||||
personIds: Set<string>;
|
||||
personIds: SvelteSet<string>;
|
||||
location: SearchLocationFilter;
|
||||
camera: SearchCameraFilter;
|
||||
date: SearchDateFilter;
|
||||
|
@ -9,9 +9,10 @@
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
import { t } from 'svelte-i18n';
|
||||
import SingleGridRow from '$lib/components/shared-components/single-grid-row.svelte';
|
||||
import type { SvelteSet } from 'svelte/reactivity';
|
||||
|
||||
interface Props {
|
||||
selectedPeople: Set<string>;
|
||||
selectedPeople: SvelteSet<string>;
|
||||
}
|
||||
|
||||
let { selectedPeople = $bindable() }: Props = $props();
|
||||
@ -43,7 +44,6 @@
|
||||
} else {
|
||||
selectedPeople.add(id);
|
||||
}
|
||||
selectedPeople = selectedPeople;
|
||||
}
|
||||
|
||||
const filterPeople = (list: PersonResponseDto[], name: string) => {
|
||||
|
@ -117,7 +117,6 @@
|
||||
await updatePartner({ id: partner.user.id, updatePartnerDto: { inTimeline } });
|
||||
|
||||
partner.inTimeline = inTimeline;
|
||||
partners = partners;
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_update_timeline_display_status'));
|
||||
}
|
||||
|
@ -35,7 +35,6 @@
|
||||
}
|
||||
|
||||
selectedAssetIds.add(suggestedAsset.id);
|
||||
selectedAssetIds = selectedAssetIds;
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
@ -48,13 +47,10 @@
|
||||
} else {
|
||||
selectedAssetIds.add(asset.id);
|
||||
}
|
||||
|
||||
selectedAssetIds = selectedAssetIds;
|
||||
};
|
||||
|
||||
const onSelectNone = () => {
|
||||
selectedAssetIds.clear();
|
||||
selectedAssetIds = selectedAssetIds;
|
||||
};
|
||||
|
||||
const onSelectAll = () => {
|
||||
|
@ -35,8 +35,6 @@
|
||||
person.updatedAt = Date.now().toString();
|
||||
}
|
||||
});
|
||||
// trigger reactivity
|
||||
people = people;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -74,9 +74,6 @@
|
||||
person.updatedAt = new Date().toISOString();
|
||||
}
|
||||
}
|
||||
|
||||
// trigger reactivity
|
||||
people = people;
|
||||
});
|
||||
});
|
||||
|
||||
@ -146,9 +143,6 @@
|
||||
message: $t('change_name_successfully'),
|
||||
type: NotificationType.Info,
|
||||
});
|
||||
|
||||
// trigger reactivity
|
||||
people = people;
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_save_name'));
|
||||
}
|
||||
|
@ -156,8 +156,6 @@
|
||||
|
||||
searchResultAlbums.push(...albums.items);
|
||||
searchResultAssets.push(...assets.items);
|
||||
searchResultAlbums = searchResultAlbums;
|
||||
searchResultAssets = searchResultAssets;
|
||||
|
||||
nextPage = assets.nextPage ? Number(assets.nextPage) : null;
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user