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