Skip to content

Commit

Permalink
fix: remove uniqueKey from ViewerAnchor API (#3541)
Browse files Browse the repository at this point in the history
* fix: remove uniqueKey from ViewerAnchor API
  • Loading branch information
haakonflatval-cognite authored Aug 2, 2023
1 parent 0a9e11f commit aeb0205
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ export type ViewerAnchorElementMapping = {
export type ViewerAnchorProps = {
position: Vector3;
children: ReactElement;
uniqueKey: string;
};

export const ViewerAnchor = ({
position,
children,
uniqueKey
}: ViewerAnchorProps): ReactElement => {
export const ViewerAnchor = ({ position, children }: ViewerAnchorProps): ReactElement => {
const viewer = useReveal();
const [divTranslation, setDivTranslation] = useState(new Vector2());
const [visible, setVisible] = useState(false);
Expand Down Expand Up @@ -50,7 +45,6 @@ export const ViewerAnchor = ({

return visible ? (
<div
key={uniqueKey}
ref={htmlRef}
style={{
position: 'absolute',
Expand Down
4 changes: 2 additions & 2 deletions react-components/stories/ViewerAnchor.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Main: Story = {
styling={styling}
fdmAssetMappingConfig={fdmAssetMappingConfig}
/>
<ViewerAnchor position={position} uniqueKey="key2">
<ViewerAnchor position={position}>
<p
style={{
backgroundColor: 'turquoise',
Expand All @@ -62,7 +62,7 @@ export const Main: Story = {
This label is stuck at position {position.toArray().join(',')}
</p>
</ViewerAnchor>
<ViewerAnchor position={position2} uniqueKey="key1">
<ViewerAnchor position={position2}>
<p
style={{
backgroundColor: 'red',
Expand Down

0 comments on commit aeb0205

Please sign in to comment.