このコミットが含まれているのは:
2025-12-07 17:21:58 +09:00
コミット 7df51fb34b
4個のファイルの変更43行の追加22行の削除
+13 -8
ファイルの表示
@@ -10,6 +10,7 @@ import WikiBody from '@/components/WikiBody'
import TabGroup, { Tab } from '@/components/common/TabGroup'
import MainArea from '@/components/layout/MainArea'
import { API_BASE_URL, SITE_TITLE } from '@/config'
import { fetchPosts } from '@/lib/posts'
import type { Post, WikiPage } from '@/types'
@@ -28,13 +29,11 @@ export default () => {
const loadMore = async (withCursor: boolean) => {
setLoading (true)
const res = await axios.get (`${ API_BASE_URL }/posts`, {
params: { tags: tags.join (' '),
match: anyFlg ? 'any' : 'all',
limit: '20',
...(withCursor && { cursor }) } })
const data = toCamel (res.data as any, { deep: true }) as { posts: Post[]
nextCursor: string }
const data = await fetchPosts ({
tags: tags.join (' '),
match: anyFlg ? 'any' : 'all',
limit: 20,
...(withCursor && { cursor }) })
setPosts (posts => (
[...((new Map ([...(withCursor ? posts : []), ...data.posts]
.map (post => [post.id, post])))
@@ -111,7 +110,13 @@ export default () => {
</title>
</Helmet>
<TagSidebar posts={posts.slice (0, 20)}/>
<TagSidebar posts={posts.slice (0, 20)} onClick={() => {
const statesToSave = {
posts, cursor,
scroll: containerRef.current?.scrollTop ?? 0 }
sessionStorage.setItem (`posts:${ tagsQuery }`,
JSON.stringify (statesToSave))
}}/>
<MainArea>
<TabGroup>