From db5d631049cf78a1ea1f2f7cdea7a1fb3c09e79b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 3 Aug 2025 22:20:35 +0800 Subject: [PATCH] :bug: Fix sphere webpage loading --- .../Client/src/components/PostEditor.vue | 4 ++-- DysonNetwork.Sphere/Client/src/views/index.vue | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/DysonNetwork.Sphere/Client/src/components/PostEditor.vue b/DysonNetwork.Sphere/Client/src/components/PostEditor.vue index d5706d3..bff61f4 100644 --- a/DysonNetwork.Sphere/Client/src/components/PostEditor.vue +++ b/DysonNetwork.Sphere/Client/src/components/PostEditor.vue @@ -7,7 +7,7 @@ :custom-request="customRequest" v-model:file-list="fileList" > -
+
- +
diff --git a/DysonNetwork.Sphere/Client/src/views/index.vue b/DysonNetwork.Sphere/Client/src/views/index.vue index cea94b9..0a25563 100644 --- a/DysonNetwork.Sphere/Client/src/views/index.vue +++ b/DysonNetwork.Sphere/Client/src/views/index.vue @@ -57,22 +57,21 @@ onMounted(() => fetchVersion()) const loading = ref(false) const activites = ref([]) -const activitesLast = computed( - () => - activites.value.sort( - (a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime(), - )[0], -) +const activitesLast = computed(() => activites.value[Math.max(activites.value.length - 1, 0)]) +const activitesHasMore = ref(true) async function fetchActivites() { if (loading.value) return + if (!activitesHasMore.value) return loading.value = true const resp = await fetch( activitesLast.value == null ? '/api/activities' : `/api/activities?cursor=${new Date(activitesLast.value.created_at).toISOString()}`, ) - activites.value.push(...(await resp.json())) + const data = await resp.json() + activites.value = [...activites.value, ...data] + activitesHasMore.value = data[0]?.type != 'empty' loading.value = false } onMounted(() => fetchActivites())