From ccc9a58362ab8b40501765e59b479497f1312ec5 Mon Sep 17 00:00:00 2001 From: danybeltran Date: Wed, 17 Jul 2024 02:20:56 -0600 Subject: [PATCH 1/2] fixes(es5): Upgrades to es2015 --- package.json | 2 +- src/utils/shared.ts | 1 - tsconfig.json | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d99762e..ce83cf8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http-react", - "version": "3.6.4", + "version": "3.6.5", "description": "React hooks for data fetching", "main": "dist/index.js", "scripts": { diff --git a/src/utils/shared.ts b/src/utils/shared.ts index be7ecee..6e2691a 100644 --- a/src/utils/shared.ts +++ b/src/utils/shared.ts @@ -194,7 +194,6 @@ export function $searchParams(input: string) { const parsedParams = new Map() - // @ts-expect-error for (let key of allKeys) { const allValues = searchParams.getAll(key) diff --git a/tsconfig.json b/tsconfig.json index 18736d8..9737e95 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES5", + "target": "ES2015", "outDir": "./dist", "module": "CommonJS", "lib": ["es6", "dom", "es2019"], From 845d81d39d87e266c10c9aaa22c13ffe6e5e7343 Mon Sep 17 00:00:00 2001 From: danybeltran Date: Thu, 18 Jul 2024 17:29:01 -0600 Subject: [PATCH 2/2] fixes(mutate): Fixes mutate not updating data after initial fetch --- package.json | 2 +- src/hooks/use-fetch.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ce83cf8..bd44cde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http-react", - "version": "3.6.5", + "version": "3.6.6", "description": "React hooks for data fetching", "main": "dist/index.js", "scripts": { diff --git a/src/hooks/use-fetch.ts b/src/hooks/use-fetch.ts index c752721..5fad1ce 100644 --- a/src/hooks/use-fetch.ts +++ b/src/hooks/use-fetch.ts @@ -980,8 +980,9 @@ export function useFetch( if (isMutating) { if (serialize($data) !== serialize(cacheForMutation.get(resolvedKey))) { - cacheForMutation.set(idString, data) + cacheForMutation.set(idString, $data) if (isMutating) { + forceMutate($data) if (handleMutate) { if (url === '') { ;(onMutate as any)($data, imperativeFetch)