Skip to content

Commit

Permalink
test: fix failed test
Browse files Browse the repository at this point in the history
  • Loading branch information
promer94 committed May 4, 2023
1 parent 621a728 commit 9afd16d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/use-swr-suspense.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,20 @@ describe('useSWR - suspense', () => {
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 Down

0 comments on commit 9afd16d

Please # to comment.