denyMoveTransitionを復活させる

This commit is contained in:
tamaina 2023-07-25 10:47:31 +00:00
parent cf764eebe3
commit 9f4df717e8
3 changed files with 12 additions and 5 deletions

View file

@ -7,7 +7,7 @@
</div>
</template>
<template #default="{ items: notes }">
<template #default="{ items: notes, denyMoveTransition }">
<div :class="[$style.root, { [$style.noGap]: noGap }]">
<MkDateSeparatedList
ref="notes"
@ -18,6 +18,7 @@
:noGap="noGap"
:ad="true"
:class="$style.notes"
:denyMoveTransition="denyMoveTransition"
>
<MkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note"/>
</MkDateSeparatedList>

View file

@ -7,8 +7,8 @@
</div>
</template>
<template #default="{ items: notifications }">
<MkDateSeparatedList v-slot="{ item: notification }" :class="$style.list" :items="notifications" :noGap="true">
<template #default="{ items: notifications, denyMoveTransition }">
<MkDateSeparatedList v-slot="{ item: notification }" :class="$style.list" :items="notifications" :noGap="true" :denyMoveTransition="denyMoveTransition">
<MkNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="`showNotificationAsNote:${notification.id}`" :note="notification.note"/>
<XNotification v-else :key="notification.id" :notification="notification" :withTime="true" :full="true" class="_panel notification"/>
</MkDateSeparatedList>

View file

@ -26,7 +26,7 @@
</MkButton>
<MkLoading v-else class="loading"/>
</div>
<slot :items="Array.from(items.values())" :fetching="fetching || moreFetching"></slot>
<slot :items="Array.from(items.values())" :fetching="fetching || moreFetching" :denyMoveTransition="denyMoveTransition"></slot>
<div v-show="!pagination.reversed && more" key="_more_" class="_margin">
<MkButton v-if="!moreFetching" v-appear="(enableInfiniteScroll && !props.disableAutoLoad) ? appearFetchMore : null" :class="$style.more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }" primary rounded @click="fetchMore">
{{ i18n.ts.loadMore }}
@ -163,6 +163,7 @@ const scrollableElementOrHtml = $computed(() => scrollableElement ?? document.ge
const visibility = useDocumentVisibility();
const isPausingUpdateByExecutingQueue = ref(false);
const denyMoveTransition = ref(false);
//#region scrolling
const checkFn = props.pagination.reversed ? isBottomVisible : isTopVisible;
@ -265,6 +266,7 @@ async function adjustScroll(fn: () => void): Promise<void> {
} catch (err) {
console.error(err, { scrollableElementOrHtml });
}
denyMoveTransition.value = true;
fn();
return await nextTick(() => {
try {
@ -276,7 +278,8 @@ async function adjustScroll(fn: () => void): Promise<void> {
} catch (err) {
console.error(err, { scrollableElementOrHtml });
}
return nextTick();
}).then(() => nextTick()).finally(() => {
denyMoveTransition.value = false;
});
}
//#endregion
@ -548,17 +551,20 @@ async function executeQueue() {
// Safari
scrollBy(scrollableElement, { top: TOLERANCE + 4, behavior: 'instant' });
backed = true;
denyMoveTransition.value = true;
await nextTick();
unshiftItems(newItems, Infinity);
await nextTick();
} else {
await adjustScroll(() => unshiftItems(newItems, Infinity));
backed = true;
denyMoveTransition.value = true;
}
items.value = new Map([...items.value].slice(0, displayLimit.value));
await nextTick();
isPausingUpdateByExecutingQueue.value = false;
denyMoveTransition.value = false;
}
function prependQueue(newItem: MisskeyEntity) {