File tree 1 file changed +8
-7
lines changed 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -97,13 +97,14 @@ export const useSWRHandler = <Data = any, Error = any>(
97
97
// If it's paused, we skip revalidation.
98
98
if ( getConfig ( ) . isPaused ( ) ) return false
99
99
100
- return suspense
101
- ? // Under suspense mode, it will always fetch on render if there is no
102
- // stale data so no need to revalidate immediately on mount again.
103
- ! isUndefined ( data )
104
- : // If there is no stale data, we need to revalidate on mount;
105
- // If `revalidateIfStale` is set to true, we will always revalidate.
106
- isUndefined ( data ) || config . revalidateIfStale
100
+ // Under suspense mode, it will always fetch on render if there is no
101
+ // stale data so no need to revalidate immediately on mount again.
102
+ // If data exists, only revalidate if `revalidateIfStale` is true.
103
+ if ( suspense ) return isUndefined ( data ) ? false : config . revalidateIfStale
104
+
105
+ // If there is no stale data, we need to revalidate on mount;
106
+ // If `revalidateIfStale` is set to true, we will always revalidate.
107
+ return isUndefined ( data ) || config . revalidateIfStale
107
108
}
108
109
109
110
// Resolve the current validating state.
You can’t perform that action at this time.
0 commit comments