fix(frontend): 登録日によるソートの場合はpaginator側のソートを使用するように (#17048)

* fix(frontend): 登録日によるソートの場合はpaginator側のソートを使用するように

* Update Changelog

* fix lint

* refactor
This commit is contained in:
かっこかり 2026-01-01 10:32:38 +09:00 committed by GitHub
parent 8577f10456
commit b5454cb2c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 9 deletions

View File

@ -13,6 +13,7 @@
- Enhance: ウィジェットの表示設定をプレビューを見ながら行えるように
- Enhance: ウィジェットの設定項目のラベルの多言語対応
- Fix: ドライブクリーナーでファイルを削除しても画面に反映されない問題を修正 #16061
- Fix: ドライブのソートが「登録日(昇順)」の場合に正しく動作しない問題を修正
### Server
- Enhance: OAuthのクライアント情報取得Client Information Discoveryにおいて、IndieWeb Living Standard 11 July 2024で定義されているJSONドキュメント形式に対応しました

View File

@ -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;
}