Skip to content

Commit

Permalink
Stories fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Savokr committed Aug 21, 2023
1 parent 488fc35 commit 1460b97
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export { use3DModelName } from './hooks/use3DModelName';
export { useFdmAssetMappings } from './hooks/useFdmAssetMappings';
export { useClickedNodeData } from './hooks/useClickedNode';
export { useCameraNavigation } from './hooks/useCameraNavigation';
export { useMappedEquipmentByRevisionList } from './hooks/useMappedEquipmentBy3DModelsList';
export { useMappedEdgesForRevisions } from './components/NodeCacheProvider/NodeCacheProvider';

// Higher order components
export { withSuppressRevealEvents } from './higher-order-components/withSuppressRevealEvents';
Expand Down
6 changes: 3 additions & 3 deletions react-components/stories/CadStylingCache.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Color, Matrix4, Vector3 } from 'three';
import { createSdkByUrlToken } from './utilities/createSdkByUrlToken';
import { type CogniteCadModel, DefaultNodeAppearance } from '@cognite/reveal';
import { useEffect, useMemo, useState, type JSX } from 'react';
import { useMappedEquipmentByRevisionList } from '../src/hooks/useMappedEquipmentBy3DModelsList';
import { useMappedEdgesForRevisions } from '../src/components/NodeCacheProvider/NodeCacheProvider';

const meta = {
title: 'Example/CadStylingCache',
Expand Down Expand Up @@ -50,13 +50,13 @@ const Models = ({ addModelOptions }: CogniteCadModelProps): JSX.Element => {

const [platformStyling, setPlatformStyling] = useState<CadModelStyling>();

const { data } = useMappedEquipmentByRevisionList([platformModelOptions]);
const { data } = useMappedEdgesForRevisions([platformModelOptions], true);

const nodeIds = useMemo(
() =>
data
?.get(`${platformModelOptions.modelId}-${platformModelOptions.revisionId}`)
?.map((edge) => edge.properties.revisionNodeId),
?.map((edgeWithNode) => edgeWithNode.edge.properties.revisionNodeId),
[data]
);

Expand Down
8 changes: 1 addition & 7 deletions react-components/stories/HighlightNode.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const StoryContent = ({ resources }: { resources: AddResourceOptions[] }): React
}
]);
void cameraNavigation.fitCameraToInstance(nodeData.fdmNode.externalId, 'pdms-mapping');
}, [nodeData]);
}, [nodeData?.fdmNode]);

return (
<>
Expand All @@ -84,12 +84,6 @@ const StoryContent = ({ resources }: { resources: AddResourceOptions[] }): React
instanceStyling={stylingGroups}
/>
<RevealToolbar />
<button
onClick={() => {
setState(!state);
}}>
Re-render resources
</button>
</>
);
};

0 comments on commit 1460b97

Please sign in to comment.