Skip to content

Commit

Permalink
fixed model name query triggering API request without caching (#3659)
Browse files Browse the repository at this point in the history
Co-authored-by: cognite-bulldozer[bot] <51074376+cognite-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
pramodcog and cognite-bulldozer[bot] authored Sep 1, 2023
1 parent 820fab7 commit 61fccea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const LayersButton = (): ReactElement => {
setPointCloudModelIds(pointCloudIds);
}
}
}, [viewer.models, cadModelIds, pointCloudModelIds]);
}, [viewer.models]);

const updated3DResourcesLayerData: Reveal3DResourcesLayerStates = useMemo(() => {
if (cadModelName.data === null && pointCloudModelName.data === null) {
Expand Down
4 changes: 3 additions & 1 deletion react-components/src/hooks/use3DModelName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export const use3DModelName = (ids: number[]): UseQueryResult<string[] | undefin
return modelResolvedNames;
};

const queryResult = useQuery<string[] | undefined>(['cdf', '3d', 'model', ids], queryFunction);
const queryResult = useQuery<string[] | undefined>(['cdf', '3d', 'model', ids], queryFunction, {
staleTime: Infinity
});

return queryResult;
};

0 comments on commit 61fccea

Please sign in to comment.