vercel / next-react-server-components

Demo repository for Next.js + React Server Components
https://next-rsc-hn.vercel.app
MIT License
984 stars 158 forks source link

RSC with delay example broken #39

Closed carledwardfp closed 2 years ago

carledwardfp commented 2 years ago

Steps to Reproduce:

  1. Clone the repository
  2. Run locally
  3. Go to /slow
  4. It will show this error: Error: storyIds.slice is not a function

Fix:

function NewsWithData() {
  const { data: storyIds } = useData('top', () => fetchData('topstories', 500))
  return (
    <>
      {storyIds
        ? storyIds.slice(0, 30).map((id) => {
            return (
              <Suspense key={id} fallback={<Spinner />}>
                <StoryWithData id={id} />
              </Suspense>
            )
          })
        : null}
    </>
  )
}