feat(web): use websocket to update the feature photo (#10683)

feat: use ws to update the feature photo
This commit is contained in:
martin
2024-06-28 21:40:18 +02:00
committed by GitHub
parent 821570f2fb
commit e0bb9add91
2 changed files with 27 additions and 3 deletions
@@ -8,6 +8,8 @@
import { getMetadataSearchQuery } from '$lib/utils/metadata-search';
import { t } from 'svelte-i18n';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import { onMount } from 'svelte';
import { websocketEvents } from '$lib/stores/websocket';
export let data: PageData;
@@ -36,6 +38,18 @@
MAX_PLACE_ITEMS = screenSize < 768 ? Math.floor(innerWidth / 150) : Math.floor(innerWidth / 172);
}
}
onMount(() => {
return websocketEvents.on('on_person_thumbnail', (personId: string) => {
people.map((person) => {
if (person.id === personId) {
person.updatedAt = Date.now().toString();
}
});
// trigger reactivity
people = people;
});
});
</script>
<svelte:window bind:innerWidth={screenSize} />