Frontend: Fixed prepending items when fresh and full
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2024-11-25 19:39:05 +01:00
parent 8aa2a4dac4
commit 5666bb4622
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
1 changed files with 4 additions and 6 deletions

View File

@ -197,7 +197,7 @@ const refresh = async (): Promise<void> => {
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
const item = res[i]; const item = res[i];
if (!updateItem(item.id, (old) => item)) { if (!updateItem(item.id, (old) => item)) {
append(item); prepend(item);
} }
ids.delete(item.id); ids.delete(item.id);
} }
@ -314,9 +314,7 @@ const prepend = (item: Item): void => {
if (!queue.value.length) { if (!queue.value.length) {
(props.pagination.reversed ? onScrollBottom : onScrollTop)( (props.pagination.reversed ? onScrollBottom : onScrollTop)(
rootEl.value, rootEl.value,
() => { unqueue
nextTick(unqueue);
}
); );
} }
@ -325,11 +323,11 @@ const prepend = (item: Item): void => {
return; return;
} }
if (items.value.length > props.displayLimit) { if (items.value.length >= props.displayLimit) {
queue.value = [...queue.value, item].slice(-props.displayLimit);
if (!queue.value.length) { if (!queue.value.length) {
nextTick(unqueue); nextTick(unqueue);
} }
queue.value = [...queue.value, item].slice(-props.displayLimit);
return; return;
} }