Frontend: Fixed pagination queuing behavior
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2024-01-03 03:35:41 +01:00
parent ab18633fbc
commit 42bf912bb9
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
1 changed files with 6 additions and 8 deletions

View File

@ -82,7 +82,6 @@ import {
} from "@/scripts/scroll"; } from "@/scripts/scroll";
import MkButton from "@/components/MkButton.vue"; import MkButton from "@/components/MkButton.vue";
import { magTransProperty } from "@/scripts-mag/mag-util"; import { magTransProperty } from "@/scripts-mag/mag-util";
import { i18n } from "@/i18n";
export type Paging< export type Paging<
E extends keyof misskey.Endpoints = keyof misskey.Endpoints E extends keyof misskey.Endpoints = keyof misskey.Endpoints
@ -296,20 +295,19 @@ const prepend = (item: Item): void => {
if (isTop) { if (isTop) {
// Prepend the item // Prepend the item
items.value.unshift(item); items.value = [item, ...items.value].slice(0, props.displayLimit);
items.value = items.value.slice(0, props.displayLimit);
} else { } else {
if (!queue.value.length) { if (!queue.value.length) {
onScrollTop(rootEl.value, () => { onScrollTop(rootEl.value, () => {
for (const queueItem of queue.value) { items.value = [
prepend(queueItem); ...queue.value.reverse(),
} ...items.value,
].slice(0, props.displayLimit);
queue.value = []; queue.value = [];
}); });
} }
queue.value.push(item); queue.value = [...queue.value, item].slice(-props.displayLimit);
queue.value = queue.value.slice(0, props.displayLimit);
} }
} }
}; };