Skip to content

Commit dec2d77

Browse files
committed
fix(toolkit-react): 🐛 remove useEffect from useResource hook and update tsconfig
- Removes the useEffect hook from the `useResource` hook in `toolkit-react`. The useEffect hook was previously used to delete the cached promise after the component was unmounted, but this is no longer necessary. - Updates the `tsconfig.base.json` file to include `incremental: true` and `tsBuildInfoFile: ".tsbuildinfo"`. This will improve the build performance of the project.
1 parent 3bb3396 commit dec2d77

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

packages/toolkit-react/src/hooks/useResource.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type UnknownObject, isFunction, isPlainObject } from "@zayne-labs/toolkit-type-helpers";
2-
import { use, useEffect } from "react";
2+
import { use } from "react";
33

44
const replacer = (_: unknown, value: unknown) => {
55
if (!isPlainObject(value)) {
@@ -74,10 +74,6 @@ const useResource = <TResource>(options: ResourceOptions<TResource>) => {
7474

7575
const result = use(cachedPromise);
7676

77-
useEffect(() => {
78-
$PromiseCache.delete(hashedKey);
79-
}, [hashedKey]);
80-
8177
return { data: result as TResource, refetch: fetchResourceAndSetCache };
8278
};
8379

tsconfig.base.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3-
"composite": true
3+
"incremental": true,
4+
"tsBuildInfoFile": ".tsbuildinfo"
45
}
56
}

0 commit comments

Comments
 (0)