mirror of
https://github.com/enso-org/enso.git
synced 2024-11-05 03:59:38 +03:00
Fetch EULA in background if user already accepted it (#10153)
This commit is contained in:
parent
6adf590d9f
commit
448272a2f9
@ -62,10 +62,19 @@ export function TermsOfServiceModal() {
|
||||
const checkboxId = React.useId()
|
||||
const { session } = authProvider.useAuth()
|
||||
|
||||
const eula = reactQuery.useSuspenseQuery(latestTermsOfService)
|
||||
|
||||
const latestVersionHash = eula.data.hash
|
||||
const localVersionHash = localStorage.get('termsOfService')?.versionHash
|
||||
const { data: latestVersionHash } = reactQuery.useSuspenseQuery({
|
||||
...latestTermsOfService,
|
||||
// If the user has already accepted EULA, we don't need to
|
||||
// block user interaction with the app while we fetch the latest version.
|
||||
// We can use the local version hash as the initial data.
|
||||
// and refetch in the background to check for updates.
|
||||
...(localVersionHash != null && {
|
||||
initialData: { hash: localVersionHash },
|
||||
initialDataUpdatedAt: 0,
|
||||
}),
|
||||
select: data => data.hash,
|
||||
})
|
||||
|
||||
const isLatest = latestVersionHash === localVersionHash
|
||||
const isAccepted = localVersionHash != null
|
||||
|
Loading…
Reference in New Issue
Block a user