Skip to content

Commit

Permalink
chore: lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonflatval-cognite committed Jul 31, 2023
1 parent b8a82a0 commit 71daaf6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 6 additions & 4 deletions react-components/src/components/InfoCard/InfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2023 Cognite AS
*/

import React, { type JSX, useState, useEffect, useRef } from 'react';
import React, { type JSX, useEffect, useRef } from 'react';
import { type Vector3 } from 'three';

import { useReveal } from '../RevealContainer/RevealContext';
Expand All @@ -24,7 +24,7 @@ export type InfoCardProps = {
export const InfoCard = ({ position, children, uniqueKey }: InfoCardProps): JSX.Element => {
const viewer = useReveal();

const [htmlTool, _setHtmlTool] = useState<HtmlOverlayTool>(new HtmlOverlayTool(viewer));
const htmlTool = useRef<HtmlOverlayTool>(new HtmlOverlayTool(viewer));

const auxContext = useAuxillaryDivContext();

Expand All @@ -49,9 +49,11 @@ export const InfoCard = ({ position, children, uniqueKey }: InfoCardProps): JSX.

const elementRef = htmlRef.current;

htmlTool.add(elementRef, position);
htmlTool.current.add(elementRef, position);

return () => htmlTool.remove(elementRef);
return () => {
htmlTool.current.remove(elementRef);
};
}, [auxContext, children, htmlRef.current]);

return <></>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
* Copyright 2023 Cognite AS
*/

import { HtmlOverlayTool } from '@cognite/reveal/tools';
import React, {
createContext,
useContext,
useState,
useCallback,
useEffect,
type JSX
} from 'react';
import React, { createContext, useContext, useState, useCallback, type JSX } from 'react';

export const AuxillaryDivProvider = ({ children }: { children: React.ReactNode }): JSX.Element => {
const [elements, setElements] = useState<JSX.Element[]>([]);
Expand Down

0 comments on commit 71daaf6

Please sign in to comment.