Fix offline mode (#7250)

* Fix offline mode

* Remove `authentication=false` from URL when logging in

---------

Co-authored-by: Paweł Buchowski <pawel.buchowski@enso.org>
This commit is contained in:
somebody1234 2023-07-13 23:35:30 +10:00 committed by GitHub
parent ca68dd94da
commit b042807790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,6 +271,11 @@ export function AuthProvider(props: AuthProviderProps) {
await new Promise(resolve => setTimeout(resolve, REQUEST_DELAY_MS))
}
}
const url = new URL(location.href)
if (url.searchParams.get('authentication') === 'false') {
url.searchParams.delete('authentication')
history.replaceState(null, '', url.toString())
}
let newUserSession: UserSession
const sharedSessionData = { email, accessToken }
if (!organization) {
@ -307,10 +312,10 @@ export function AuthProvider(props: AuthProviderProps) {
})
// `userSession` MUST NOT be a dependency as this effect always does a `setUserSession`,
// which would result in an infinite loop.
// `initialized` MUST NOT be a dependency as it breaks offline mode.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
cognito,
initialized,
logger,
onAuthenticated,
session,