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) => {
|
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;
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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) => {
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
@ -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) => {
|
||||||
|
@ -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'));
|
||||||
}
|
}
|
||||||
|
@ -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 = () => {
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
person.updatedAt = Date.now().toString();
|
person.updatedAt = Date.now().toString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// trigger reactivity
|
|
||||||
people = people;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -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'));
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user