|
|
|
@@ -4,7 +4,9 @@ import { match } from 'path-to-regexp' |
|
|
|
import { fetchPost, fetchPosts, fetchPostChanges } from '@/lib/posts' |
|
|
|
import { postsKeys, tagsKeys, wikiKeys } from '@/lib/queryKeys' |
|
|
|
import { fetchTagByName } from '@/lib/tags' |
|
|
|
import { fetchWikiPageByTitle, fetchWikiPages } from '@/lib/wiki' |
|
|
|
import { fetchWikiPage, |
|
|
|
fetchWikiPageByTitle, |
|
|
|
fetchWikiPages } from '@/lib/wiki' |
|
|
|
|
|
|
|
type Prefetcher = (qc: QueryClient, url: URL) => Promise<void> |
|
|
|
|
|
|
|
@@ -33,11 +35,19 @@ const prefetchWikiPageShow: Prefetcher = async (qc, url) => { |
|
|
|
queryKey: wikiKeys.show (title, { version }), |
|
|
|
queryFn: () => fetchWikiPageByTitle (title, { version }) }) |
|
|
|
|
|
|
|
if (wikiPage?.body) |
|
|
|
if (wikiPage) |
|
|
|
{ |
|
|
|
const effectiveId = String (wikiPage.id ?? '') |
|
|
|
await qc.prefetchQuery ({ |
|
|
|
queryKey: wikiKeys.index ({ }), |
|
|
|
queryFn: () => fetchWikiPages ({ }) }) |
|
|
|
queryKey: wikiKeys.show (effectiveId, { }), |
|
|
|
queryFn: () => fetchWikiPage (effectiveId, { } ) }) |
|
|
|
|
|
|
|
if (wikiPage.body) |
|
|
|
{ |
|
|
|
await qc.prefetchQuery ({ |
|
|
|
queryKey: wikiKeys.index ({ }), |
|
|
|
queryFn: () => fetchWikiPages ({ }) }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const effectiveTitle = wikiPage?.title ?? title |
|
|
|
|