From 86bb42b52985e966ba207f604feb1071b0b1a15f Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Wed, 18 Jan 2023 23:48:05 +0100 Subject: [PATCH] YEET --- packages/client/src/components/MkPagination.vue | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/packages/client/src/components/MkPagination.vue b/packages/client/src/components/MkPagination.vue index 3327a6796..95b86c51a 100644 --- a/packages/client/src/components/MkPagination.vue +++ b/packages/client/src/components/MkPagination.vue @@ -278,17 +278,6 @@ const prepend = (item: Item): void => { // Prepend the item items.value.unshift(item); if(props.externalItemArray) props.externalItemArray.value.unshift(item); - - // オーバーフローしたら古いアイテムは捨てる - if (items.value.length >= props.displayLimit) { - // このやり方だとVue 3.2以降アニメーションが動かなくなる - //this.items = items.value.slice(0, props.displayLimit); - while (items.value.length >= props.displayLimit) { - items.value.pop(); - if(props.externalItemArray) props.externalItemArray.value.pop(); - } - more.value = true; - } } else { queue.value.push(item); onScrollTop(rootEl.value, () => { @@ -308,7 +297,8 @@ const append = (item: Item): void => { const removeItem = (finder: (item: Item) => boolean): boolean => { const i = items.value.findIndex(finder); - if (i === -1) { + const j = props.externalItemArray?.findIndex(finder); + if (i === -1 && j === -1) { return false; } @@ -319,7 +309,8 @@ const removeItem = (finder: (item: Item) => boolean): boolean => { const updateItem = (id: Item['id'], replacer: (old: Item) => Item): boolean => { const i = items.value.findIndex(item => item.id === id); - if (i === -1) { + const j = props.externalItemArray?.findIndex(item => item.id === id); + if (i === -1 && j === -1) { return false; }