From 1f5ce50f7e0c37c0f74d9fb6e0550fa2d1d7a61a Mon Sep 17 00:00:00 2001 From: TatsuyaYamamoto Date: Fri, 21 Mar 2025 19:42:48 +0900 Subject: [PATCH] fix: isLoading: false --- packages/react-tweet/src/hooks.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-tweet/src/hooks.ts b/packages/react-tweet/src/hooks.ts index dd4c1c7..b9a944f 100644 --- a/packages/react-tweet/src/hooks.ts +++ b/packages/react-tweet/src/hooks.ts @@ -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, }