Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/react-tweet/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ export const useTweet = (
)

return {
// If data is `undefined` then it might be the first render where SWR hasn't started doing
// If id is provided but data is `undefined` then it might be the first render where SWR hasn't started doing
// any work, so we set `isLoading` to `true`.
isLoading: Boolean(isLoading || (data === undefined && !error)),
isLoading: Boolean(
isLoading || (id !== undefined && data === undefined && !error)
),
data,
error,
}
Expand Down