Skip to content

Commit 0832cdd

Browse files
JasonMan34Itamar Zwi
and
Itamar Zwi
authored
Do not refresh cache if the value was returned from the cache (#333)
Co-authored-by: Itamar Zwi <211736459@idf.il>
1 parent d725956 commit 0832cdd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/useFetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function useFetch<TData = any>(...args: UseFetchArgs): UseFetch<TData> {
131131
return theData
132132
}
133133

134-
if (cachePolicy === CACHE_FIRST) {
134+
if (cachePolicy === CACHE_FIRST && !response.isCached) {
135135
await cache.set(response.id, newRes.clone())
136136
}
137137

0 commit comments

Comments
 (0)