diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-06-29 15:11:25 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-06-29 15:11:25 +0900 |
| commit | f1deb89e348eb8f1a39b51e33a0ae33d59529feb (patch) | |
| tree | 2e92a7a21a1bf377719e1b125a9ac44bc14a529e /packages/frontend/src/pages/my-lists | |
| parent | feat(backend): クリップ内でノートを検索できるように (diff) | |
| download | misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.gz misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.tar.bz2 misskey-f1deb89e348eb8f1a39b51e33a0ae33d59529feb.zip | |
refactor(frontend): improve pagination implementation
Diffstat (limited to 'packages/frontend/src/pages/my-lists')
| -rw-r--r-- | packages/frontend/src/pages/my-lists/list.vue | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/packages/frontend/src/pages/my-lists/list.vue b/packages/frontend/src/pages/my-lists/list.vue index e33125ac93..74ac47c571 100644 --- a/packages/frontend/src/pages/my-lists/list.vue +++ b/packages/frontend/src/pages/my-lists/list.vue @@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only <div class="_gaps_s"> <MkButton rounded primary style="margin: 0 auto;" @click="addUser()">{{ i18n.ts.addUser }}</MkButton> - <MkPagination ref="paginationEl" :pagination="membershipsPagination" withControl> + <MkPagination :paginator="membershipsPaginator" withControl> <template #default="{ items }"> <div class="_gaps_s"> <div v-for="item in items" :key="item.id"> @@ -52,7 +52,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { computed, ref, useTemplateRef, watch } from 'vue'; +import { computed, markRaw, ref, watch } from 'vue'; import * as Misskey from 'misskey-js'; import MkButton from '@/components/MkButton.vue'; import * as os from '@/os.js'; @@ -69,6 +69,7 @@ import { ensureSignin } from '@/i.js'; import MkPagination from '@/components/MkPagination.vue'; import { mainRouter } from '@/router.js'; import { prefer } from '@/preferences.js'; +import { Paginator } from '@/utility/paginator.js'; const $i = ensureSignin(); @@ -80,17 +81,15 @@ const props = defineProps<{ listId: string; }>(); -const paginationEl = useTemplateRef('paginationEl'); const list = ref<Misskey.entities.UserList | null>(null); const isPublic = ref(false); const name = ref(''); -const membershipsPagination = { - endpoint: 'users/lists/get-memberships' as const, +const membershipsPaginator = markRaw(new Paginator('users/lists/get-memberships', { limit: 30, - params: computed(() => ({ + computedParams: computed(() => ({ listId: props.listId, })), -}; +})); function fetchList() { misskeyApi('users/lists/show', { @@ -109,7 +108,7 @@ function addUser() { listId: list.value.id, userId: user.id, }).then(() => { - paginationEl.value?.paginator.reload(); + membershipsPaginator.reload(); }); }); } @@ -125,7 +124,7 @@ async function removeUser(item, ev) { listId: list.value.id, userId: item.userId, }).then(() => { - paginationEl.value?.paginator.removeItem(item.id); + membershipsPaginator.removeItem(item.id); }); }, }], ev.currentTarget ?? ev.target); @@ -147,7 +146,7 @@ async function showMembershipMenu(item, ev) { userId: item.userId, withReplies, }).then(() => { - paginationEl.value!.paginator.updateItem(item.id, (old) => ({ + membershipsPaginator.updateItem(item.id, (old) => ({ ...old, withReplies, })); |