Reviewed-on: #355 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #355 でマージされました.
このコミットが含まれているのは:
@@ -3,7 +3,7 @@ import { match } from 'path-to-regexp'
|
||||
|
||||
import { fetchPost, fetchPosts, fetchPostChanges } from '@/lib/posts'
|
||||
import { postsKeys, tagsKeys, wikiKeys } from '@/lib/queryKeys'
|
||||
import { fetchTagByName, fetchTag, fetchTagChanges, fetchTags } from '@/lib/tags'
|
||||
import { fetchNicoTags, fetchTagByName, fetchTag, fetchTagChanges, fetchTags } from '@/lib/tags'
|
||||
import { fetchWikiPage,
|
||||
fetchWikiPageByTitle,
|
||||
fetchWikiPages } from '@/lib/wiki'
|
||||
@@ -170,6 +170,24 @@ const prefetchTagsIndex: Prefetcher = async (qc, url) => {
|
||||
}
|
||||
|
||||
|
||||
const prefetchNicoTagsIndex: Prefetcher = async (qc, url) => {
|
||||
const keys = {
|
||||
name: url.searchParams.get ('name') ?? '',
|
||||
linkedTag: url.searchParams.get ('linked_tag') ?? '',
|
||||
linkStatus: (url.searchParams.get ('link_status') || 'all') as
|
||||
'all' | 'linked' | 'unlinked',
|
||||
page: Number (url.searchParams.get ('page') || 1),
|
||||
limit: Number (url.searchParams.get ('limit') || 20),
|
||||
order: (url.searchParams.get ('order') || 'updated_at:desc') as
|
||||
'name:asc' | 'name:desc' | 'created_at:asc' | 'created_at:desc'
|
||||
| 'updated_at:asc' | 'updated_at:desc' }
|
||||
|
||||
await qc.prefetchQuery ({
|
||||
queryKey: tagsKeys.nicoIndex (keys),
|
||||
queryFn: () => fetchNicoTags (keys) })
|
||||
}
|
||||
|
||||
|
||||
const prefetchTagShow: Prefetcher = async (qc, url) => {
|
||||
const m = mTag (url.pathname)
|
||||
if (!(m))
|
||||
@@ -206,6 +224,8 @@ export const routePrefetchers: { test: (u: URL) => boolean; run: Prefetcher }[]
|
||||
&& Boolean (mWiki (u.pathname))),
|
||||
run: prefetchWikiPageShow },
|
||||
{ test: u => u.pathname === '/tags', run: prefetchTagsIndex },
|
||||
{ test: u => ['/tags/nico', '/nico/tags'].includes (u.pathname),
|
||||
run: prefetchNicoTagsIndex },
|
||||
{ test: u => (!(['/tags/nico', '/tags/changes'].includes (u.pathname))
|
||||
&& Boolean (mTag (u.pathname))),
|
||||
run: prefetchTagShow },
|
||||
|
||||
新しい課題から参照
ユーザをブロックする