mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-21 03:30:42 +00:00
fix(frontend): 登録日によるソートの場合はpaginator側のソートを使用するように (#17048)
* fix(frontend): 登録日によるソートの場合はpaginator側のソートを使用するように * Update Changelog * fix lint * refactor
This commit is contained in:
@@ -133,12 +133,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</TransitionGroup>
|
||||
|
||||
<MkButton
|
||||
v-show="filesPaginator.canFetchOlder.value"
|
||||
v-appear="shouldEnableInfiniteScroll ? filesPaginator.fetchOlder : null"
|
||||
v-show="canFetchFiles"
|
||||
v-appear="shouldEnableInfiniteScroll ? fetchMoreFiles : null"
|
||||
:class="$style.loadMore"
|
||||
primary
|
||||
rounded
|
||||
@click="filesPaginator.fetchOlder()"
|
||||
@click="fetchMoreFiles"
|
||||
>{{ i18n.ts.loadMore }}</MkButton>
|
||||
|
||||
<div v-if="filesPaginator.items.value.length == 0 && foldersPaginator.items.value.length == 0 && !fetching" :class="$style.empty">
|
||||
@@ -238,10 +238,9 @@ const filesPaginator = markRaw(new Paginator('drive/files', {
|
||||
params: () => ({ // 自動でリロードしたくないためcomputedParamsは使わない
|
||||
folderId: folder.value ? folder.value.id : null,
|
||||
type: props.type,
|
||||
sort: sortModeSelect.value,
|
||||
sort: ['-createdAt', '+createdAt'].includes(sortModeSelect.value) ? null : sortModeSelect.value,
|
||||
}),
|
||||
}));
|
||||
|
||||
const foldersPaginator = markRaw(new Paginator('drive/folders', {
|
||||
limit: 30,
|
||||
canFetchDetection: 'limit',
|
||||
@@ -250,6 +249,16 @@ const foldersPaginator = markRaw(new Paginator('drive/folders', {
|
||||
}),
|
||||
}));
|
||||
|
||||
const canFetchFiles = computed(() => !fetching.value && (filesPaginator.order.value === 'oldest' ? filesPaginator.canFetchNewer.value : filesPaginator.canFetchOlder.value));
|
||||
|
||||
async function fetchMoreFiles() {
|
||||
if (filesPaginator.order.value === 'oldest') {
|
||||
filesPaginator.fetchNewer();
|
||||
} else {
|
||||
filesPaginator.fetchOlder();
|
||||
}
|
||||
}
|
||||
|
||||
const filesTimeline = makeDateGroupedTimelineComputedRef(filesPaginator.items, 'month');
|
||||
const shouldBeGroupedByDate = computed(() => ['+createdAt', '-createdAt'].includes(sortModeSelect.value));
|
||||
|
||||
@@ -260,10 +269,10 @@ watch(sortModeSelect, () => {
|
||||
|
||||
async function initialize() {
|
||||
fetching.value = true;
|
||||
await Promise.all([
|
||||
foldersPaginator.init(),
|
||||
filesPaginator.init(),
|
||||
]);
|
||||
await foldersPaginator.reload();
|
||||
filesPaginator.initialDirection = sortModeSelect.value === '-createdAt' ? 'newer' : 'older';
|
||||
filesPaginator.order.value = sortModeSelect.value === '-createdAt' ? 'oldest' : 'newest';
|
||||
await filesPaginator.reload();
|
||||
fetching.value = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user