Page MenuHomePhabricator

D12697.id42161.diff
No OneTemporary

D12697.id42161.diff

diff --git a/lib/components/farcaster-data-handler.react.js b/lib/components/farcaster-data-handler.react.js
--- a/lib/components/farcaster-data-handler.react.js
+++ b/lib/components/farcaster-data-handler.react.js
@@ -9,7 +9,7 @@
} from '../actions/relationship-actions.js';
import { NeynarClientContext } from '../components/neynar-client-provider.react.js';
import { useLegacyAshoatKeyserverCall } from '../keyserver-conn/legacy-keyserver-call.js';
-import { isLoggedInToAuthoritativeKeyserver } from '../selectors/user-selectors.js';
+import { isLoggedInToIdentityAndAuthoritativeKeyserver } from '../selectors/user-selectors.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
import { relationshipActions } from '../types/relationship-types.js';
import { useCurrentUserFID } from '../utils/farcaster-utils.js';
@@ -20,11 +20,9 @@
function FarcasterDataHandler(): React.Node {
const isActive = useSelector(state => state.lifecycleState !== 'background');
- const isLoggedInToAuthKeyserver = useSelector(
- isLoggedInToAuthoritativeKeyserver,
- );
const currentUserID = useSelector(state => state.currentUserInfo?.id);
- const loggedIn = !!currentUserID && isLoggedInToAuthKeyserver;
+
+ const loggedIn = useSelector(isLoggedInToIdentityAndAuthoritativeKeyserver);
const neynarClient = React.useContext(NeynarClientContext)?.client;
diff --git a/lib/selectors/user-selectors.js b/lib/selectors/user-selectors.js
--- a/lib/selectors/user-selectors.js
+++ b/lib/selectors/user-selectors.js
@@ -171,6 +171,11 @@
const isLoggedInToAuthoritativeKeyserver: (state: BaseAppState<>) => boolean =
isLoggedInToKeyserver(authoritativeKeyserverID());
+const isLoggedInToIdentityAndAuthoritativeKeyserver: (
+ state: BaseAppState<>,
+) => boolean = (state: BaseAppState<>) =>
+ isLoggedInToAuthoritativeKeyserver(state) && isLoggedIn(state);
+
const usersWithPersonalThreadSelector: (
state: BaseAppState<>,
) => $ReadOnlySet<string> = createSelector(
@@ -272,6 +277,7 @@
isLoggedIn,
isLoggedInToKeyserver,
isLoggedInToAuthoritativeKeyserver,
+ isLoggedInToIdentityAndAuthoritativeKeyserver,
usersWithPersonalThreadSelector,
savedEmojiAvatarSelectorForCurrentUser,
getRelativeUserIDs,
diff --git a/native/components/auto-join-community-handler.react.js b/native/components/auto-join-community-handler.react.js
--- a/native/components/auto-join-community-handler.react.js
+++ b/native/components/auto-join-community-handler.react.js
@@ -10,7 +10,7 @@
import { NeynarClientContext } from 'lib/components/neynar-client-provider.react.js';
import blobService from 'lib/facts/blob-service.js';
import { extractKeyserverIDFromID } from 'lib/keyserver-conn/keyserver-call-utils.js';
-import { isLoggedInToAuthoritativeKeyserver } from 'lib/selectors/user-selectors.js';
+import { isLoggedInToIdentityAndAuthoritativeKeyserver } from 'lib/selectors/user-selectors.js';
import { farcasterChannelTagBlobHash } from 'lib/shared/community-utils.js';
import type { AuthMetadata } from 'lib/shared/identity-client-context.js';
import { IdentityClientContext } from 'lib/shared/identity-client-context.js';
@@ -30,11 +30,7 @@
function AutoJoinCommunityHandler(): React.Node {
const isActive = useSelector(state => state.lifecycleState !== 'background');
- const isLoggedInToAuthKeyserver = useSelector(
- isLoggedInToAuthoritativeKeyserver,
- );
- const currentUserID = useSelector(state => state.currentUserInfo?.id);
- const loggedIn = !!currentUserID && isLoggedInToAuthKeyserver;
+ const loggedIn = useSelector(isLoggedInToIdentityAndAuthoritativeKeyserver);
const fid = useCurrentUserFID();
diff --git a/native/components/connect-farcaster-alert-handler.react.js b/native/components/connect-farcaster-alert-handler.react.js
--- a/native/components/connect-farcaster-alert-handler.react.js
+++ b/native/components/connect-farcaster-alert-handler.react.js
@@ -4,7 +4,7 @@
import * as React from 'react';
import { recordAlertActionType } from 'lib/actions/alert-actions.js';
-import { isLoggedInToAuthoritativeKeyserver } from 'lib/selectors/user-selectors.js';
+import { isLoggedInToIdentityAndAuthoritativeKeyserver } from 'lib/selectors/user-selectors.js';
import {
alertTypes,
type RecordAlertActionPayload,
@@ -22,11 +22,7 @@
const isActive = useSelector(state => state.lifecycleState !== 'background');
- const isLoggedInToAuthKeyserver = useSelector(
- isLoggedInToAuthoritativeKeyserver,
- );
- const currentUserID = useSelector(state => state.currentUserInfo?.id);
- const loggedIn = !!currentUserID && isLoggedInToAuthKeyserver;
+ const loggedIn = useSelector(isLoggedInToIdentityAndAuthoritativeKeyserver);
const fid = useCurrentUserFID();
diff --git a/native/navigation/navigation-handler.react.js b/native/navigation/navigation-handler.react.js
--- a/native/navigation/navigation-handler.react.js
+++ b/native/navigation/navigation-handler.react.js
@@ -2,10 +2,7 @@
import * as React from 'react';
-import {
- isLoggedIn,
- isLoggedInToAuthoritativeKeyserver,
-} from 'lib/selectors/user-selectors.js';
+import { isLoggedInToIdentityAndAuthoritativeKeyserver } from 'lib/selectors/user-selectors.js';
import { logInActionType, logOutActionType } from './action-types.js';
import ModalPruner from './modal-pruner.react.js';
@@ -62,13 +59,8 @@
) {
const { dispatch } = props;
- const hasCurrentUserInfo = useSelector(isLoggedIn);
+ const loggedIn = useSelector(isLoggedInToIdentityAndAuthoritativeKeyserver);
- const isLoggedInToAuthKeyserver = useSelector(
- isLoggedInToAuthoritativeKeyserver,
- );
-
- const loggedIn = hasCurrentUserInfo && isLoggedInToAuthKeyserver;
const navLoggedIn = useIsAppLoggedIn();
const prevLoggedInRef = React.useRef<?boolean>();

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 11:43 AM (20 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574782
Default Alt Text
D12697.id42161.diff (5 KB)

Event Timeline