Skip to content

Commit 7b5fc72

Browse files
committed
WIP: add mock data
1 parent d08509d commit 7b5fc72

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/velog-web/src/app/(list)/recent/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ export const metadata: Metadata = {
99
}
1010

1111
export default async function RecentHome() {
12-
const data = await getRecentPosts({ limit: 50 })
12+
// const data = await getRecentPosts({ limit: 50 })
1313

14-
if (!data) {
15-
notFound()
16-
}
14+
// if (!data) {
15+
// notFound()
16+
// }
1717

18-
return <RecentPosts data={data} />
18+
return <RecentPosts data={[]} />
1919
}

packages/velog-web/src/features/home/components/RecentPosts/RecentPosts.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { useEffect, useRef, useState } from 'react'
66
import { Post } from '@/graphql/helpers/generated'
77

88
type Props = {
9-
data: Post[]
9+
data: any[]
1010
}
1111

1212
function RecentPosts({ data }: Props) {
1313
const hasEffectRun = useRef<boolean>(false)
1414

1515
const [initialData, setInitialData] = useState<Post[]>([])
16-
const { posts, isFetching, fetchMore, isLoading } = useRecentPosts(initialData)
16+
const { posts, isFetching, fetchMore, isLoading } = useRecentPosts(initialData as Post[])
1717

1818
useEffect(() => {
1919
if (hasEffectRun.current) return
@@ -25,13 +25,13 @@ function RecentPosts({ data }: Props) {
2525
const infiniteData = localStorage.getItem(storageKey)
2626

2727
if (!infiniteData) {
28-
setInitialData(data)
28+
setInitialData(data as any)
2929
return
3030
}
3131

3232
const parsed: Post[] = JSON.parse(infiniteData) || []
3333
const savedPosts = parsed?.slice(data.length) || []
34-
setInitialData([...data, ...savedPosts])
34+
setInitialData([...data, ...savedPosts] as Post[])
3535

3636
const position = Number(localStorage.getItem(`${storageKey}/scrollPosition`))
3737
if (!position) return

0 commit comments

Comments
 (0)