diff --git a/package.json b/package.json index 737c608..14a8731 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http-react", - "version": "3.5.3", + "version": "3.5.4", "description": "React hooks for data fetching", "main": "dist/index.js", "scripts": { diff --git a/src/components/FetchConfigAsync.tsx b/src/components/FetchConfigAsync.tsx index 0096ccd..d75ac72 100644 --- a/src/components/FetchConfigAsync.tsx +++ b/src/components/FetchConfigAsync.tsx @@ -23,16 +23,11 @@ export async function FetchConfigAsync(props: FetchContextType) { const $data = $value.data ?? $value - if (!isDefined(valuesMemory.get(resolvedKey))) { - valuesMemory.set(resolvedKey, $data) - } - if (!isDefined(fetcherDefaults.get(resolvedKey))) { - fetcherDefaults.set(resolvedKey, $data) - } + valuesMemory.set(resolvedKey, $data) - if (!isDefined(cacheProvider.get(resolvedKey))) { - cacheProvider.set(resolvedKey, $data) - } + fetcherDefaults.set(resolvedKey, $data) + + cacheProvider.set(resolvedKey, $data) } for (let defaultKey in defaults) { @@ -42,15 +37,8 @@ export async function FetchConfigAsync(props: FetchContextType) { }) if (isDefined(id)) { - if (!isDefined(valuesMemory.get(resolvedKey))) { - valuesMemory.set(resolvedKey, await defaults[defaultKey]?.value) - } - if (!isDefined(fetcherDefaults.get(resolvedKey))) { - fetcherDefaults.set(resolvedKey, await defaults[defaultKey]?.value) - } - } - - if (!isDefined(cacheProvider.get(resolvedKey))) { + valuesMemory.set(resolvedKey, await defaults[defaultKey]?.value) + fetcherDefaults.set(resolvedKey, await defaults[defaultKey]?.value) cacheProvider.set(resolvedKey, await defaults[defaultKey]?.value) } } diff --git a/src/components/index.tsx b/src/components/index.tsx index ddcd1c5..1b80a3d 100644 --- a/src/components/index.tsx +++ b/src/components/index.tsx @@ -77,16 +77,11 @@ export function FetchConfig(props: FetchContextType) { parsedChunk = dataChunk } - if (!isDefined(valuesMemory.get(resolvedKey))) { - valuesMemory.set(resolvedKey, parsedChunk) - } - if (!isDefined(fetcherDefaults.get(resolvedKey))) { - fetcherDefaults.set(resolvedKey, parsedChunk) - } + valuesMemory.set(resolvedKey, parsedChunk) - if (!isDefined(cacheProvider.get(resolvedKey))) { - cacheProvider.set(resolvedKey, parsedChunk) - } + fetcherDefaults.set(resolvedKey, parsedChunk) + + cacheProvider.set(resolvedKey, parsedChunk) } for (let defaultKey in defaults) { @@ -96,15 +91,8 @@ export function FetchConfig(props: FetchContextType) { }) if (isDefined(id)) { - if (!isDefined(valuesMemory.get(resolvedKey))) { - valuesMemory.set(resolvedKey, defaults[defaultKey]?.value) - } - if (!isDefined(fetcherDefaults.get(resolvedKey))) { - fetcherDefaults.set(resolvedKey, defaults[defaultKey]?.value) - } - } - - if (!isDefined(cacheProvider.get(resolvedKey))) { + valuesMemory.set(resolvedKey, defaults[defaultKey]?.value) + fetcherDefaults.set(resolvedKey, defaults[defaultKey]?.value) cacheProvider.set(resolvedKey, defaults[defaultKey]?.value) } }