Skip to content

Commit b23f876

Browse files
committed
👔 Move disable option logic directly onto react event listeners
1 parent 27152e9 commit b23f876

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

static/app/components/searchQueryBuilder/askSeer.tsx

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useEffect, useRef, useState} from 'react';
1+
import {useRef, useState} from 'react';
22
import styled from '@emotion/styled';
33
import {useOption} from '@react-aria/listbox';
44
import type {ComboBoxState} from '@react-stately/combobox';
@@ -51,26 +51,9 @@ export function useSeerAcknowledgeMutation() {
5151
function AskSeerConsentOption<T>({state}: {state: ComboBoxState<T>}) {
5252
const organization = useOrganization();
5353
const itemRef = useRef<HTMLDivElement>(null);
54-
const linkRef = useRef<HTMLAnchorElement>(null);
5554
const [optionDisableOverride, setOptionDisableOverride] = useState(false);
5655
const {mutate: seerAcknowledgeMutate} = useSeerAcknowledgeMutation();
5756

58-
useEffect(() => {
59-
const link = linkRef.current;
60-
if (!link) return undefined;
61-
62-
const disableOption = () => setOptionDisableOverride(true);
63-
const enableOption = () => setOptionDisableOverride(false);
64-
65-
link.addEventListener('mouseover', disableOption);
66-
link.addEventListener('mouseout', enableOption);
67-
68-
return () => {
69-
link.removeEventListener('mouseover', disableOption);
70-
link.removeEventListener('mouseout', enableOption);
71-
};
72-
}, []);
73-
7457
const {optionProps, labelProps, isFocused, isPressed} = useOption(
7558
{
7659
key: ASK_SEER_CONSENT_ITEM_KEY,
@@ -111,7 +94,8 @@ function AskSeerConsentOption<T>({state}: {state: ComboBoxState<T>}) {
11194
{
11295
dataProcessingPolicy: (
11396
<TooltipSubExternalLink
114-
ref={linkRef}
97+
onMouseOver={() => setOptionDisableOverride(true)}
98+
onMouseOut={() => setOptionDisableOverride(false)}
11599
href="https://docs.sentry.io/product/security/ai-ml-policy/#use-of-identifying-data-for-generative-ai-features"
116100
/>
117101
),

0 commit comments

Comments
 (0)