Skip to content

Commit

Permalink
fix: add useMemo dependencies and explaratory variable
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonflatval-cognite committed Sep 13, 2023
1 parent fe3ce1d commit cf2be26
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ export function NodeCacheProvider({ children }: { children?: ReactNode }): React
const fdmCache = useMemo(() => {
const cache =
revealKeepAliveData?.fdmNodeCache.current ?? new FdmNodeCache(cdfClient, fdmClient);
if (revealKeepAliveData !== undefined) {

const isInRevealKeepAliveContext = revealKeepAliveData !== undefined;
if (isInRevealKeepAliveContext) {
revealKeepAliveData.fdmNodeCache.current = cache;
}

return cache;
}, []);
}, [cdfClient, fdmClient]);

return (
<FdmNodeCacheContext.Provider value={{ cache: fdmCache }}>
Expand Down

0 comments on commit cf2be26

Please sign in to comment.