From fdf9966ef67571f9e7354996484ac441848b17a8 Mon Sep 17 00:00:00 2001 From: Natty Date: Fri, 12 Jan 2024 04:47:00 +0100 Subject: [PATCH] Frontend: Fixed pagination bugs --- .../frontend/client/src/components/MagPagination.vue | 5 ++--- fe_calckey/frontend/client/src/pages/follow-requests.vue | 4 ++-- fe_calckey/frontend/magnetar-common/src/be-api.ts | 8 ++++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fe_calckey/frontend/client/src/components/MagPagination.vue b/fe_calckey/frontend/client/src/components/MagPagination.vue index c5ffcaf..d810824 100644 --- a/fe_calckey/frontend/client/src/components/MagPagination.vue +++ b/fe_calckey/frontend/client/src/components/MagPagination.vue @@ -225,12 +225,11 @@ const fetchMore = async (): Promise => { !next.value || initialFetching.value || moreFetching.value || - items.value.length === 0 + items.value.length === 0 || + !next.value.searchParams.has("pagination") ) return; - if (next.value.searchParams.has("pagination")) return; - const nextCursorRaw = next.value.searchParams.get("pagination") as string; const nextCursorDecoded = { ...Object.fromEntries(new URLSearchParams(nextCursorRaw).entries()), diff --git a/fe_calckey/frontend/client/src/pages/follow-requests.vue b/fe_calckey/frontend/client/src/pages/follow-requests.vue index 5f369ef..6e58a4b 100644 --- a/fe_calckey/frontend/client/src/pages/follow-requests.vue +++ b/fe_calckey/frontend/client/src/pages/follow-requests.vue @@ -318,7 +318,7 @@ definePageMetadata( } > .name { - flex-grow: 1; + flex-basis: 33%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; @@ -327,7 +327,7 @@ definePageMetadata( } > .value { - flex-grow: 2; + flex-grow: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/fe_calckey/frontend/magnetar-common/src/be-api.ts b/fe_calckey/frontend/magnetar-common/src/be-api.ts index d3b856c..2235410 100644 --- a/fe_calckey/frontend/magnetar-common/src/be-api.ts +++ b/fe_calckey/frontend/magnetar-common/src/be-api.ts @@ -71,8 +71,8 @@ function extractHeaderRel( continue; } - for (const links of v.split(",").map(String.prototype.trim)) { - const [url, relPar] = links.split(";").map(String.prototype.trim); + for (const links of v.split(",").map((s) => s.trim())) { + const [url, relPar] = links.split(";").map((s) => s.trim()); if (!url || !relPar) { continue; } @@ -180,6 +180,10 @@ export class MagApiClient { } }) .catch((e) => { + console.error( + "Generic API error. This should not usually happen!", + e + ); throw { status: -1, code: "Client:GenericApiError",