Left rail log in icon decided by atom, cache user profile

Summary:
Previously the left rail state was decided by prescense of user profile but we are moving to logged in state being based on the atom.

As a result we need to cache the user profile so we have something to display when user not on vpn on startup

Reviewed By: aigoncharov

Differential Revision: D44502477

fbshipit-source-id: 11462d24c773d6d364e844b4f606e124e5278348
This commit is contained in:
Luke De Feo
2023-03-30 10:05:59 -07:00
committed by Facebook GitHub Bot
parent cb11b360fc
commit 5a6091f6f8
4 changed files with 22 additions and 8 deletions

View File

@@ -9,8 +9,12 @@
import React from 'react';
import {Dialog, getFlipperLib} from 'flipper-plugin';
import {isTest, UserNotSignedInError} from 'flipper-common';
import {getUser} from '../fb-stubs/user';
import {
isTest,
UserNotSignedInError,
UserUnauthorizedError,
} from 'flipper-common';
import {fetchUser} from '../fb-stubs/user';
import {State, Store} from '../reducers/index';
import {checkForUpdate} from '../fb-stubs/checkForUpdate';
import {getAppVersion} from '../utils/info';
@@ -226,7 +230,7 @@ async function verifyLighthouseAndUserLoggedIn(
});
try {
const user = await getUser();
const user = await fetchUser();
spinnerDialog.close();
// User is logged in
if (user) {
@@ -237,7 +241,10 @@ async function verifyLighthouseAndUserLoggedIn(
}
} catch (e) {
spinnerDialog.close();
if (e instanceof UserNotSignedInError) {
if (
e instanceof UserNotSignedInError ||
e instanceof UserUnauthorizedError
) {
// connection, but user is not logged in
return await showPleaseLoginDialog(store, title);
}