Skip to content
Discussion options

You must be logged in to vote

Hi! The screenshots are broken, but can you put a logger here:

url => fetch(url).then(res => res.json()).then(data => {
  console.log(data)
  return data
})

And you will probably see that the fetched data is an empty array. It's not undefined.

This is the correct behavior, for the initial render there is no data, so SWR returns the fallback. And then SWR fetches the data (gets an empty array), and returns that data instead of the fallback.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AlexTechNoir
Comment options

Answer selected by AlexTechNoir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants