diff --git a/web/src/lib/components/photos-page/asset-grid.svelte b/web/src/lib/components/photos-page/asset-grid.svelte
index 124681716..31c62185c 100644
--- a/web/src/lib/components/photos-page/asset-grid.svelte
+++ b/web/src/lib/components/photos-page/asset-grid.svelte
@@ -324,6 +324,22 @@
>
{#if element}
+
+
+ {#if !$assetStore.initialized}
+
+
+ {#each Array(100) as _}
+
+ {/each}
+
+
+ {/if}
+
+
+ {#if $assetStore.initialized && $assetStore.buckets.length === 0}
+
+ {/if}
{#each $assetStore.buckets as bucket, bucketIndex (bucketIndex)}
= {};
+ initialized = false;
timelineHeight = 0;
buckets: AssetBucket[] = [];
assets: AssetResponseDto[] = [];
@@ -52,6 +53,7 @@ export class AssetStore {
subscribe = this.store$.subscribe;
async init(viewport: Viewport) {
+ this.initialized = false;
this.timelineHeight = 0;
this.buckets = [];
this.assets = [];
@@ -63,6 +65,8 @@ export class AssetStore {
key: api.getKey(),
});
+ this.initialized = true;
+
this.buckets = buckets.map((bucket) => {
const unwrappedWidth = (3 / 2) * bucket.count * THUMBNAIL_HEIGHT * (7 / 10);
const rows = Math.ceil(unwrappedWidth / viewport.width);
diff --git a/web/src/routes/(user)/archive/+page.svelte b/web/src/routes/(user)/archive/+page.svelte
index fbabbe485..7fee8c915 100644
--- a/web/src/routes/(user)/archive/+page.svelte
+++ b/web/src/routes/(user)/archive/+page.svelte
@@ -14,25 +14,18 @@
import { AssetAction } from '$lib/constants';
import { createAssetInteractionStore } from '$lib/stores/asset-interaction.store';
import { AssetStore } from '$lib/stores/assets.store';
- import { api, TimeBucketSize } from '@api';
- import { onMount } from 'svelte';
+ import { TimeBucketSize } from '@api';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import Plus from 'svelte-material-icons/Plus.svelte';
import type { PageData } from './$types';
export let data: PageData;
- let assetCount = 1;
const assetStore = new AssetStore({ size: TimeBucketSize.Month, isArchived: true });
const assetInteractionStore = createAssetInteractionStore();
const { isMultiSelectState, selectedAssets } = assetInteractionStore;
$: isAllFavorite = Array.from($selectedAssets).every((asset) => asset.isFavorite);
-
- onMount(async () => {
- const { data: stats } = await api.assetApi.getAssetStats({ isArchived: true });
- assetCount = stats.total;
- });
{#if $isMultiSelectState}
@@ -52,10 +45,12 @@
{/if}
-
- {#if assetCount}
-
- {:else}
-
- {/if}
+
+
+
+
diff --git a/web/src/routes/(user)/favorites/+page.svelte b/web/src/routes/(user)/favorites/+page.svelte
index 67d7ff082..9bb0ffd8d 100644
--- a/web/src/routes/(user)/favorites/+page.svelte
+++ b/web/src/routes/(user)/favorites/+page.svelte
@@ -14,25 +14,18 @@
import { AssetAction } from '$lib/constants';
import { createAssetInteractionStore } from '$lib/stores/asset-interaction.store';
import { AssetStore } from '$lib/stores/assets.store';
- import { api, TimeBucketSize } from '@api';
- import { onMount } from 'svelte';
+ import { TimeBucketSize } from '@api';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import Plus from 'svelte-material-icons/Plus.svelte';
import type { PageData } from './$types';
export let data: PageData;
- let assetCount = 1;
const assetStore = new AssetStore({ size: TimeBucketSize.Month, isFavorite: true });
const assetInteractionStore = createAssetInteractionStore();
const { isMultiSelectState, selectedAssets } = assetInteractionStore;
$: isAllArchive = Array.from($selectedAssets).every((asset) => asset.isArchived);
-
- onMount(async () => {
- const { data: stats } = await api.assetApi.getAssetStats({ isFavorite: true });
- assetCount = stats.total;
- });
@@ -53,10 +46,12 @@
{/if}
-
- {#if assetCount}
-
- {:else}
-
- {/if}
+
+
+
+
diff --git a/web/src/routes/(user)/photos/+page.svelte b/web/src/routes/(user)/photos/+page.svelte
index 63a933984..99ce53e12 100644
--- a/web/src/routes/(user)/photos/+page.svelte
+++ b/web/src/routes/(user)/photos/+page.svelte
@@ -17,25 +17,18 @@
import { createAssetInteractionStore } from '$lib/stores/asset-interaction.store';
import { AssetStore } from '$lib/stores/assets.store';
import { openFileUploadDialog } from '$lib/utils/file-uploader';
- import { TimeBucketSize, api } from '@api';
- import { onMount } from 'svelte';
+ import { TimeBucketSize } from '@api';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import Plus from 'svelte-material-icons/Plus.svelte';
import type { PageData } from './$types';
export let data: PageData;
- let assetCount = 1;
const assetStore = new AssetStore({ size: TimeBucketSize.Month, isArchived: false });
const assetInteractionStore = createAssetInteractionStore();
const { isMultiSelectState, selectedAssets } = assetInteractionStore;
$: isAllFavorite = Array.from($selectedAssets).every((asset) => asset.isFavorite);
-
- onMount(async () => {
- const { data: stats } = await api.assetApi.getAssetStats({ isArchived: false });
- assetCount = stats.total;
- });
@@ -59,14 +52,15 @@
{/if}
- {#if assetCount}
-
- {#if data.user.memoriesEnabled}
-
- {/if}
-
- {:else}
- openFileUploadDialog()} />
- {/if}
+
+ {#if data.user.memoriesEnabled}
+
+ {/if}
+ openFileUploadDialog()}
+ slot="empty"
+ />
+