summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkDrive.vue
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:11:25 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-06-29 15:11:25 +0900
commitf1deb89e348eb8f1a39b51e33a0ae33d59529feb (patch)
tree2e92a7a21a1bf377719e1b125a9ac44bc14a529e /packages/frontend/src/components/MkDrive.vue
parentfeat(backend): クリップ内でノートを検索できるように (diff)
downloadmisskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.gz
misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.bz2
misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.zip
refactor(frontend): improve pagination implementation
Diffstat (limited to 'packages/frontend/src/components/MkDrive.vue')
-rw-r--r--packages/frontend/src/components/MkDrive.vue46
1 files changed, 18 insertions, 28 deletions
diff --git a/packages/frontend/src/components/MkDrive.vue b/packages/frontend/src/components/MkDrive.vue
index 9d89c2f846..9fe1c7ef21 100644
--- a/packages/frontend/src/components/MkDrive.vue
+++ b/packages/frontend/src/components/MkDrive.vue
@@ -130,7 +130,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { nextTick, onActivated, onBeforeUnmount, onMounted, ref, useTemplateRef, watch, computed, TransitionGroup } from 'vue';
+import { nextTick, onActivated, onBeforeUnmount, onMounted, ref, useTemplateRef, watch, computed, TransitionGroup, markRaw } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from './MkButton.vue';
import type { MenuItem } from '@/types/menu.js';
@@ -146,10 +146,10 @@ import { prefer } from '@/preferences.js';
import { chooseFileFromPcAndUpload, selectDriveFolder } from '@/utility/drive.js';
import { store } from '@/store.js';
import { isSeparatorNeeded, getSeparatorInfo, makeDateGroupedTimelineComputedRef } from '@/utility/timeline-date-separate.js';
-import { usePagination } from '@/composables/use-pagination.js';
import { globalEvents, useGlobalEvent } from '@/events.js';
import { checkDragDataType, getDragData, setDragData } from '@/drag-and-drop.js';
import { getDriveFileMenu } from '@/utility/get-drive-file-menu.js';
+import { Paginator } from '@/utility/paginator.js';
const props = withDefaults(defineProps<{
initialFolder?: Misskey.entities.DriveFolder['id'] | null;
@@ -195,33 +195,23 @@ const fetching = ref(true);
const sortModeSelect = ref<NonNullable<Misskey.entities.DriveFilesRequest['sort']>>('+createdAt');
-const filesPaginator = usePagination({
- ctx: {
- endpoint: 'drive/files',
- limit: 30,
- canFetchDetection: 'limit',
- params: computed(() => ({
- folderId: folder.value ? folder.value.id : null,
- type: props.type,
- sort: sortModeSelect.value,
- })),
- },
- autoInit: false,
- autoReInit: false,
-});
+const filesPaginator = markRaw(new Paginator('drive/files', {
+ limit: 30,
+ canFetchDetection: 'limit',
+ params: () => ({ // 自動でリロードしたくないためcomputedParamsは使わない
+ folderId: folder.value ? folder.value.id : null,
+ type: props.type,
+ sort: sortModeSelect.value,
+ }),
+}));
-const foldersPaginator = usePagination({
- ctx: {
- endpoint: 'drive/folders',
- limit: 30,
- canFetchDetection: 'limit',
- params: computed(() => ({
- folderId: folder.value ? folder.value.id : null,
- })),
- },
- autoInit: false,
- autoReInit: false,
-});
+const foldersPaginator = markRaw(new Paginator('drive/folders', {
+ limit: 30,
+ canFetchDetection: 'limit',
+ params: () => ({ // 自動でリロードしたくないためcomputedParamsは使わない
+ folderId: folder.value ? folder.value.id : null,
+ }),
+}));
const filesTimeline = makeDateGroupedTimelineComputedRef(filesPaginator.items, 'month');