Skip to content

Commit

Permalink
Remove set/del in keyedCache
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Apr 25, 2024
1 parent 4268f68 commit 4e7a4b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/composables/keyedCache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type MaybeRefOrGetter, toValue } from "@vueuse/core";
import { computed, del, type Ref, ref, set, unref } from "vue";
import { computed, type Ref, ref, unref } from "vue";

import type { ApiResponse } from "@/api/schema";

Expand Down Expand Up @@ -75,14 +75,14 @@ export function useKeyedCache<T>(
if (isAlreadyLoading) {
return;
}
set(loadingItem.value, itemId, true);
loadingItem.value[itemId] = true;
try {
const fetchItem = unref(fetchItemHandler);
const { data } = await fetchItem({ id: itemId });
set(storedItems.value, itemId, data);
storedItems.value[itemId] = data;
return data;
} finally {
del(loadingItem.value, itemId);
delete loadingItem.value[itemId];
}
}

Expand Down

0 comments on commit 4e7a4b3

Please sign in to comment.