Skip to content

Commit 5361193

Browse files
authored
Merge pull request #134 from danybeltran/feat-cancelonchange-render
fix(cancelOnChange):
2 parents ce13848 + 3f7a079 commit 5361193

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-react",
3-
"version": "2.6.5",
3+
"version": "2.6.6",
44
"description": "React hooks for data fetching",
55
"main": "dist/index.js",
66
"scripts": {

src/hooks/use-fetch.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,12 +995,16 @@ export function useFetch<FetchDataType = any, BodyType = any>(
995995
React.useMemo(() => {
996996
if (windowExists) {
997997
if (!suspense) {
998-
if (auto && url !== '' && !isPending(resolvedKey)) {
999-
initializeRevalidation()
998+
if (auto && url !== '') {
999+
if (!isPending(resolvedKey)) {
1000+
initializeRevalidation()
1001+
} else {
1002+
requestAbortController?.abort()
1003+
}
10001004
}
10011005
}
10021006
}
1003-
}, [resolvedKey])
1007+
}, [resolvedKey, serialize(optionsConfig)])
10041008

10051009
useEffect(() => {
10061010
const revalidateAfterUnmount = revalidateOnMount

0 commit comments

Comments
 (0)