Skip to content

Commit

Permalink
propsからpageElを削除
Browse files Browse the repository at this point in the history
  • Loading branch information
adzukimame committed Dec 8, 2024
1 parent 103109c commit 3a16e87
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/frontend/src/components/MkPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ export type Paging<E extends keyof MisskeyEndpoints = keyof MisskeyEndpoints> =
reversed?: boolean;

offsetMode?: boolean;

pageEl?: HTMLElement;
};
</script>

Expand Down Expand Up @@ -141,8 +139,7 @@ const {
enableInfiniteScroll,
} = defaultStore.reactiveState;

const contentEl = computed(() => props.pagination.pageEl ?? rootEl.value);
const scrollableElement = computed(() => contentEl.value ? getScrollContainer(contentEl.value) : document.body);
const scrollableElement = computed(() => rootEl.value ? getScrollContainer(rootEl.value) : document.body);

const visibility = useDocumentVisibility();

Expand Down Expand Up @@ -173,13 +170,13 @@ watch(rootEl, () => {
});
});

watch([backed, contentEl], () => {
watch([backed, rootEl], () => {
if (!backed.value) {
if (!contentEl.value) return;
if (!rootEl.value) return;

scrollRemove.value = props.pagination.reversed
? onScrollBottom(contentEl.value, executeQueue, TOLERANCE)
: onScrollTop(contentEl.value, (topVisible) => { if (topVisible) executeQueue(); }, TOLERANCE);
? onScrollBottom(rootEl.value, executeQueue, TOLERANCE)
: onScrollTop(rootEl.value, (topVisible) => { if (topVisible) executeQueue(); }, TOLERANCE);
} else {
if (scrollRemove.value) scrollRemove.value();
scrollRemove.value = null;
Expand Down Expand Up @@ -338,7 +335,7 @@ const appearFetchMoreAhead = async (): Promise<void> => {
fetchMoreAppearTimeout();
};

const isTop = (): boolean => isBackTop.value || (props.pagination.reversed ? isBottomVisible : isTopVisible)(contentEl.value!, TOLERANCE);
const isTop = (): boolean => isBackTop.value || (props.pagination.reversed ? isBottomVisible : isTopVisible)(rootEl.value!, TOLERANCE);

watch(visibility, () => {
if (visibility.value === 'hidden') {
Expand Down Expand Up @@ -436,7 +433,7 @@ onDeactivated(() => {
});

function toBottom() {
scrollToBottom(contentEl.value!);
scrollToBottom(rootEl.value!);
}

onBeforeMount(() => {
Expand Down

0 comments on commit 3a16e87

Please sign in to comment.