Skip to content

Commit f6127e8

Browse files
dvoytenkohuozhi
andauthored
keepPreviousData: return fallback instead of undefined value (#4084)
Co-authored-by: Jiachi Liu <[email protected]>
1 parent d64ad41 commit f6127e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index/use-swr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export const useSWRHandler = <Data = any, Error = any>(
278278

279279
const returnedData = keepPreviousData
280280
? isUndefined(cachedData)
281-
? laggyDataRef.current
281+
? laggyDataRef.current ?? data
282282
: cachedData
283283
: data
284284

0 commit comments

Comments
 (0)