Skip to content

Commit

Permalink
chore: add useMemo back
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Feb 18, 2025
1 parent afc4b67 commit faa239c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/hooks/useGlobalCache.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ export default function useGlobalCache<CacheType>(
});
};

// Create cache
React.useMemo(
() => {
buildCache();
},
/* eslint-disable react-hooks/exhaustive-deps */
[fullPathStr],
/* eslint-enable */
);

let cacheEntity = globalCache.opGet(fullPathStr);

// HMR clean the cache but not trigger `useMemo` again
Expand Down

0 comments on commit faa239c

Please sign in to comment.