Skip to content

Commit

Permalink
fix typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nleroy917 committed Jul 25, 2024
1 parent 25dca40 commit dc7e53a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions web/src/components/project/view-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, useState, useRef } from 'react';
import { Fragment, useRef, useState } from 'react';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import Tooltip, { TooltipProps } from 'react-bootstrap/Tooltip';
import { useSearchParams } from 'react-router-dom';
Expand All @@ -20,8 +20,6 @@ export const ViewSelector = (props: ViewSelectorProps) => {
const { filteredSamples } = props;
const [searchParams, setSearchParams] = useSearchParams();

console.log(filteredSamples)

const { namespace, projectName, tag } = useProjectPage();
const { view, setView } = useProjectSelectedView();

Expand All @@ -31,7 +29,9 @@ export const ViewSelector = (props: ViewSelectorProps) => {
const projectViews = projectViewsQuery.data;

const [showViewOptionsModal, setShowViewOptionsModal] = useState(false);
const selectRef = useRef(null);

// shouldnt use any, but react-select types are a mess
const selectRef = useRef<any>(null);

const { user } = useSession();
const { data: projectInfo } = useProjectAnnotation(namespace, projectName, tag);
Expand Down Expand Up @@ -66,7 +66,7 @@ export const ViewSelector = (props: ViewSelectorProps) => {
<OverlayTrigger placement="top" delay={{ show: 250, hide: 500 }} overlay={renderTooltip}>
<div className="w-100">
<ReactSelect
ref={selectRef}
ref={selectRef}
styles={{
control: (provided) => ({
...provided,
Expand All @@ -92,7 +92,11 @@ export const ViewSelector = (props: ViewSelectorProps) => {
searchParams.set('view', selectedOption.value);
setSearchParams(searchParams);
}
setTimeout(function() {selectRef.current.blur()}, 50);
setTimeout(() => {
if (selectRef.current) {
selectRef.current.blur();
}
}, 50);
}}
isDisabled={projectViews?.views.length === 0 || projectViewsIsLoading}
isClearable
Expand Down

0 comments on commit dc7e53a

Please sign in to comment.