@@ -23,13 +23,36 @@ export const ASK_SEER_CONSENT_ITEM_KEY = 'ask_seer_consent';
23
23
const setupCheckQueryKey = ( orgSlug : string ) =>
24
24
`/organizations/${ orgSlug } /seer/setup-check/` ;
25
25
26
- function AskSeerConsentOption < T > ( { state } : { state : ComboBoxState < T > } ) {
26
+ export function useSeerAcknowledgeMutation ( ) {
27
27
const api = useApi ( ) ;
28
28
const queryClient = useQueryClient ( ) ;
29
29
const organization = useOrganization ( ) ;
30
+
31
+ const { mutate} = useMutation ( {
32
+ mutationKey : [ setupCheckQueryKey ( organization . slug ) ] ,
33
+ mutationFn : ( ) => {
34
+ return promptsUpdate ( api , {
35
+ organization,
36
+ feature : 'seer_autofix_setup_acknowledged' ,
37
+ status : 'dismissed' ,
38
+ } ) ;
39
+ } ,
40
+ onSuccess : ( ) => {
41
+ queryClient . invalidateQueries ( {
42
+ queryKey : [ setupCheckQueryKey ( organization . slug ) ] ,
43
+ } ) ;
44
+ } ,
45
+ } ) ;
46
+
47
+ return { mutate} ;
48
+ }
49
+
50
+ function AskSeerConsentOption < T > ( { state} : { state : ComboBoxState < T > } ) {
51
+ const organization = useOrganization ( ) ;
30
52
const itemRef = useRef < HTMLDivElement > ( null ) ;
31
53
const linkRef = useRef < HTMLAnchorElement > ( null ) ;
32
54
const [ optionDisableOverride , setOptionDisableOverride ] = useState ( false ) ;
55
+ const { mutate : seerAcknowledgeMutate } = useSeerAcknowledgeMutation ( ) ;
33
56
34
57
useEffect ( ( ) => {
35
58
const link = linkRef . current ;
@@ -47,22 +70,6 @@ function AskSeerConsentOption<T>({state}: {state: ComboBoxState<T>}) {
47
70
} ;
48
71
} , [ ] ) ;
49
72
50
- const seerAcknowledgeMutation = useMutation ( {
51
- mutationKey : [ setupCheckQueryKey ( organization . slug ) ] ,
52
- mutationFn : ( ) => {
53
- return promptsUpdate ( api , {
54
- organization,
55
- feature : 'seer_autofix_setup_acknowledged' ,
56
- status : 'dismissed' ,
57
- } ) ;
58
- } ,
59
- onSuccess : ( ) => {
60
- queryClient . invalidateQueries ( {
61
- queryKey : [ setupCheckQueryKey ( organization . slug ) ] ,
62
- } ) ;
63
- } ,
64
- } ) ;
65
-
66
73
const { optionProps, labelProps, isFocused, isPressed} = useOption (
67
74
{
68
75
key : ASK_SEER_CONSENT_ITEM_KEY ,
@@ -80,7 +87,7 @@ function AskSeerConsentOption<T>({state}: {state: ComboBoxState<T>}) {
80
87
organization,
81
88
action : 'consent_accepted' ,
82
89
} ) ;
83
- seerAcknowledgeMutation . mutate ( ) ;
90
+ seerAcknowledgeMutate ( ) ;
84
91
} ;
85
92
86
93
return (
0 commit comments