From a586f9ffaf9202910776a4fbe9ff0c596188523f Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Wed, 21 May 2025 13:53:36 +0900 Subject: [PATCH] chore: migrate to masto v7 --- app/components/timeline/TimelineNotifications.vue | 2 +- app/composables/cache.ts | 2 +- app/composables/masto/notification.ts | 2 +- app/composables/masto/search.ts | 4 ++-- app/composables/paginator.ts | 2 +- app/composables/tiptap/suggestion.ts | 4 ++-- app/middleware/1.permalink.global.ts | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/components/timeline/TimelineNotifications.vue b/app/components/timeline/TimelineNotifications.vue index b966b7d4..e64d2702 100644 --- a/app/components/timeline/TimelineNotifications.vue +++ b/app/components/timeline/TimelineNotifications.vue @@ -13,7 +13,7 @@ const options = { limit: 30, types: filter ? [filter] : [] } // Default limit is 20 notifications, and servers are normally caped to 30 const paginator = useMastoClient().v1.notifications.list(options) -const stream = useStreaming(client => client.user.notification.subscribe()) +const stream = useStreaming(client => client.user.subscribe()) lastAccessedNotificationRoute.value = route.path.replace(/\/notifications\/?/, '') diff --git a/app/composables/cache.ts b/app/composables/cache.ts index 83d25c05..0b9ef2bf 100644 --- a/app/composables/cache.ts +++ b/app/composables/cache.ts @@ -74,7 +74,7 @@ export async function fetchAccountByHandle(acct: string): Promise, options: UseSearchOpt ...resolveUnref(options), resolve: !!currentUser.value, }) - const nextResults = await paginator.next() + const nextResults = await paginator.values().next() done.value = !!nextResults.done if (!nextResults.done) @@ -91,7 +91,7 @@ export function useSearch(query: MaybeRefOrGetter, options: UseSearchOpt return loading.value = true - const nextResults = await paginator.next() + const nextResults = await paginator.values().next() loading.value = false done.value = !!nextResults.done diff --git a/app/composables/paginator.ts b/app/composables/paginator.ts index 93aeed1f..e7f47724 100644 --- a/app/composables/paginator.ts +++ b/app/composables/paginator.ts @@ -12,7 +12,7 @@ export function usePaginator( // called `next` method will mutate the internal state of the variable, // and we need its initial state after HMR // so clone it - const paginator = _paginator.clone() + const paginator = _paginator.values() const state = ref(isHydrated.value ? 'idle' : 'loading') const items = ref([]) diff --git a/app/composables/tiptap/suggestion.ts b/app/composables/tiptap/suggestion.ts index fdaa24cd..36e42662 100644 --- a/app/composables/tiptap/suggestion.ts +++ b/app/composables/tiptap/suggestion.ts @@ -28,7 +28,7 @@ export const TiptapMentionSuggestion: Partial = import.meta.s return [] const paginator = useMastoClient().v2.search.list({ q: query, type: 'accounts', limit: 25, resolve: true }) - return (await paginator.next()).value?.accounts ?? [] + return (await paginator.values().next()).value?.accounts ?? [] }, render: createSuggestionRenderer(TiptapMentionList), } @@ -47,7 +47,7 @@ export const TiptapHashtagSuggestion: Partial = { resolve: false, excludeUnreviewed: true, }) - return (await paginator.next()).value?.hashtags ?? [] + return (await paginator.values().next()).value?.hashtags ?? [] }, render: createSuggestionRenderer(TiptapHashtagList), } diff --git a/app/middleware/1.permalink.global.ts b/app/middleware/1.permalink.global.ts index 754d0815..7aa2740a 100644 --- a/app/middleware/1.permalink.global.ts +++ b/app/middleware/1.permalink.global.ts @@ -44,7 +44,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => { // If we're logged in, search for the local id the account or status corresponds to const paginator = masto.client.value.v2.search.list({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 }) - const { accounts, statuses } = (await paginator.next()).value ?? { accounts: [], statuses: [] } + const { accounts, statuses } = (await paginator.values().next()).value ?? { accounts: [], statuses: [] } if (statuses[0]) return getStatusRoute(statuses[0])