Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
promer94 committed May 4, 2023
1 parent 9afd16d commit 7d72b99
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions test/use-swr-suspense.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,15 @@ describe('useSWR - suspense', () => {
const { data } = useSWR(key, k => createResponse(k), {
suspense: true
})

if (data === initialKey) {
setKey(updatedKey)
}

if (data !== renderedResults[renderedResults.length - 1]) {
renderedResults.push(data)
}

useEffect(() => {
if (data === initialKey) {
setKey(updatedKey)
}
}, [data])

if (data !== renderedResults[renderedResults.length - 1]) {
renderedResults.push(data)
}
return <>{data}</>
}

Expand All @@ -221,7 +215,7 @@ describe('useSWR - suspense', () => {
<Section />
</Suspense>
)

await sleep(20)
await screen.findByText(updatedKey)
// fixes https://github.com/vercel/swr/issues/57
// initialKey' -> undefined -> updatedKey
Expand Down

0 comments on commit 7d72b99

Please # to comment.