Page MenuHomePhabricator

D13716.id45205.diff
No OneTemporary

D13716.id45205.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
@@ -2,11 +2,11 @@
import * as React from 'react';
+import { NeynarClientContext } from './neynar-client-provider.react.js';
+import { useUserIdentityCache } from './user-identity-cache.react.js';
import { setAuxUserFIDsActionType } from '../actions/aux-user-actions.js';
-import { useFindUserIdentities } from '../actions/find-user-identities-actions.js';
import { updateRelationshipsActionTypes } from '../actions/relationship-actions.js';
import { setSyncedMetadataEntryActionType } from '../actions/synced-metadata-actions.js';
-import { NeynarClientContext } from '../components/neynar-client-provider.react.js';
import { useIsLoggedInToIdentityAndAuthoritativeKeyserver } from '../hooks/account-hooks.js';
import { useUpdateRelationships } from '../hooks/relationship-hooks.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
@@ -36,7 +36,8 @@
const getFarcasterUsers =
identityServiceClient?.identityClient.getFarcasterUsers;
- const findUserIdentities = useFindUserIdentities();
+ const { getCachedUserIdentity, getUserIdentities: findUserIdentities } =
+ useUserIdentityCache();
const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
@@ -159,23 +160,26 @@
return;
}
- if (fid) {
+ const { identities: userIdentities } = await findUserIdentities([
+ currentUserID,
+ ]);
+ const identityFID = userIdentities[currentUserID]?.farcasterID;
+ const identityFIDRequestTimedOut = identityFID
+ ? false
+ : getCachedUserIdentity(currentUserID) === undefined;
+
+ if (fid && !identityFIDRequestTimedOut && fid !== identityFID) {
+ await unlinkFID();
+ return;
+ } else if (fid) {
const isCurrentUserFIDValid =
await neynarClient.checkIfCurrentUserFIDIsValid(fid);
-
if (!isCurrentUserFIDValid) {
await unlinkFID();
- return;
}
-
return;
}
- const { identities: userIdentities } = await findUserIdentities([
- currentUserID,
- ]);
- const identityFID = userIdentities[currentUserID]?.farcasterID;
-
if (identityFID) {
dispatch({
type: setSyncedMetadataEntryActionType,
@@ -195,6 +199,7 @@
fid,
unlinkFID,
dispatch,
+ getCachedUserIdentity,
]);
React.useEffect(() => {

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 4:30 PM (2 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2539881
Default Alt Text
D13716.id45205.diff (2 KB)

Event Timeline