fix(web): properly update activityManager when browsing assets (#18909)

This commit is contained in:
Robin Brisa 2025-06-12 13:13:35 +02:00 committed by GitHub
parent 94e9adf625
commit 0322a8b1d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 73 additions and 35 deletions

View file

@ -138,16 +138,6 @@
}
};
const updateComments = async () => {
if (album) {
try {
await activityManager.refreshActivities(album.id, asset.id);
} catch (error) {
handleError(error, $t('errors.unable_to_get_comments_number'));
}
}
};
const onAssetUpdate = ({ asset: assetUpdate }: { event: 'upload' | 'update'; asset: AssetResponseDto }) => {
if (assetUpdate.id === asset.id) {
asset = assetUpdate;
@ -180,10 +170,6 @@
if (!sharedLink) {
await handleGetAllAlbums();
}
if (album) {
activityManager.init(album.id, asset.id);
}
});
onDestroy(() => {
@ -370,8 +356,8 @@
}
});
$effect(() => {
if (isShared && asset.id) {
handlePromiseError(updateComments());
if (album && isShared && asset.id) {
handlePromiseError(activityManager.init(album.id, asset.id));
}
});
$effect(() => {
@ -510,7 +496,7 @@
onVideoStarted={handleVideoStarted}
/>
{/if}
{#if $slideshowState === SlideshowState.None && isShared && ((album && album.isActivityEnabled) || activityManager.commentCount > 0)}
{#if $slideshowState === SlideshowState.None && isShared && ((album && album.isActivityEnabled) || activityManager.commentCount > 0) && !activityManager.isLoading}
<div class="absolute bottom-0 end-0 mb-20 me-8">
<ActivityStatus
disabled={!album?.isActivityEnabled}