Skip to content

Commit 845d81d

Browse files
committed
fixes(mutate):
Fixes mutate not updating data after initial fetch
1 parent ccc9a58 commit 845d81d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
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": "3.6.5",
3+
"version": "3.6.6",
44
"description": "React hooks for data fetching",
55
"main": "dist/index.js",
66
"scripts": {

src/hooks/use-fetch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,9 @@ export function useFetch<FetchDataType = any, BodyType = any>(
980980

981981
if (isMutating) {
982982
if (serialize($data) !== serialize(cacheForMutation.get(resolvedKey))) {
983-
cacheForMutation.set(idString, data)
983+
cacheForMutation.set(idString, $data)
984984
if (isMutating) {
985+
forceMutate($data)
985986
if (handleMutate) {
986987
if (url === '') {
987988
;(onMutate as any)($data, imperativeFetch)

0 commit comments

Comments
 (0)