Skip to content

Commit 2df7807

Browse files
committed
👔 Move disable option logic directly onto react event listeners
1 parent 720bbf0 commit 2df7807

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';
@@ -50,26 +50,9 @@ export function useSeerAcknowledgeMutation() {
5050
function AskSeerConsentOption<T>({state}: {state: ComboBoxState<T>}) {
5151
const organization = useOrganization();
5252
const itemRef = useRef<HTMLDivElement>(null);
53-
const linkRef = useRef<HTMLAnchorElement>(null);
5453
const [optionDisableOverride, setOptionDisableOverride] = useState(false);
5554
const {mutate: seerAcknowledgeMutate} = useSeerAcknowledgeMutation();
5655

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

0 commit comments

Comments
 (0)