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