fix(frontend): 連合一覧等のページネーションが壊れていたのを修正 (#14439)

* fix

* fix

* fix CHANGELOG.md

* 開発環境以外でログが出ないように

---------

Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
おさむのひと
2024-09-24 10:09:55 +09:00
committed by GitHub
parent 23a07c2706
commit 98de7ca526
3 changed files with 20 additions and 13 deletions

View File

@@ -125,8 +125,6 @@ const items = ref<MisskeyEntityMap>(new Map());
*/
const queue = ref<MisskeyEntityMap>(new Map());
const offset = ref(0);
/**
* 初期化中かどうかtrueならMkLoadingで全て隠す
*/
@@ -179,7 +177,9 @@ watch([backed, contentEl], () => {
if (!backed.value) {
if (!contentEl.value) return;
scrollRemove.value = (props.pagination.reversed ? onScrollBottom : onScrollTop)(contentEl.value, executeQueue, TOLERANCE);
scrollRemove.value = props.pagination.reversed
? onScrollBottom(contentEl.value, executeQueue, TOLERANCE)
: onScrollTop(contentEl.value, (topVisible) => { if (topVisible) executeQueue(); }, TOLERANCE);
} else {
if (scrollRemove.value) scrollRemove.value();
scrollRemove.value = null;
@@ -223,7 +223,6 @@ async function init(): Promise<void> {
more.value = true;
}
offset.value = res.length;
error.value = false;
fetching.value = false;
}, err => {
@@ -244,7 +243,7 @@ const fetchMore = async (): Promise<void> => {
...params,
limit: SECOND_FETCH_LIMIT,
...(props.pagination.offsetMode ? {
offset: offset.value,
offset: items.value.size,
} : {
untilId: Array.from(items.value.keys()).at(-1),
}),
@@ -294,7 +293,6 @@ const fetchMore = async (): Promise<void> => {
moreFetching.value = false;
}
}
offset.value += res.length;
}, err => {
moreFetching.value = false;
});
@@ -308,7 +306,7 @@ const fetchMoreAhead = async (): Promise<void> => {
...params,
limit: SECOND_FETCH_LIMIT,
...(props.pagination.offsetMode ? {
offset: offset.value,
offset: items.value.size,
} : {
sinceId: Array.from(items.value.keys()).at(-1),
}),
@@ -320,7 +318,6 @@ const fetchMoreAhead = async (): Promise<void> => {
items.value = concatMapWithArray(items.value, res);
more.value = true;
}
offset.value += res.length;
moreFetching.value = false;
}, err => {
moreFetching.value = false;