@@ -4,8 +4,9 @@ import { Trans } from '@lingui/react/macro'
44import { DashboardRoutes , EnhanceableSite , userGuideStatus } from '@masknet/shared-base'
55import { makeStyles , useCustomSnackbar } from '@masknet/theme'
66import { Checkbox , FormControlLabel , Typography } from '@mui/material'
7- import { memo , useCallback , useState } from 'react'
7+ import { memo , useState } from 'react'
88import { useNavigate , useSearchParams } from 'react-router-dom'
9+ import { useAsyncFn } from 'react-use'
910import { requestPermissionFromExtensionPage } from '../../../../shared-ui/index.js'
1011import { definedSiteAdaptors } from '../../../../shared/site-adaptors/definitions.js'
1112import { PrimaryButton } from '../../../components/PrimaryButton/index.js'
@@ -57,7 +58,7 @@ export const Component = memo(function Welcome() {
5758 const navigate = useNavigate ( )
5859
5960 const snackbar = useCustomSnackbar ( )
60- const handleAgree = useCallback ( async ( ) => {
61+ const [ { loading } , handleAgree ] = useAsyncFn ( async ( ) => {
6162 if ( allowedToCollect ) {
6263 Services . Settings . setTelemetryEnabled ( true )
6364 }
@@ -108,7 +109,7 @@ export const Component = memo(function Welcome() {
108109 < SecondaryButton variant = "rounded" width = "125px" size = "large" onClick = { ( ) => window . close ( ) } >
109110 < Trans > Cancel</ Trans >
110111 </ SecondaryButton >
111- < PrimaryButton width = "125px" size = "large" color = "primary" onClick = { handleAgree } >
112+ < PrimaryButton width = "125px" size = "large" color = "primary" onClick = { handleAgree } disabled = { loading } >
112113 < Trans > Agree</ Trans >
113114 </ PrimaryButton >
114115 </ div >
0 commit comments