Skip to content

Commit

Permalink
[lib] Don't show Farcaster prompt for users after they unlink Farcaster
Browse files Browse the repository at this point in the history
Summary: If the user unlinks their Farcaster identity, we should set it to `NO_FID_METADATA` so they don't get prompted again.

Test Plan: I looked through the code for places that call `useCurrentUserFID` to see where `undefined`/`null` is differentiated. I saw that `ConnectFarcasterAlertHandler` calls `shouldSkipConnectFarcasterAlert`, which differentiates the two. I confirmed that setting `NO_FID_METADATA` is better, so that we return `null` and so that `ConnectFarcasterAlertHandler` doesn't prompt the user to connect their Farcaster account in this case

Reviewers: will

Reviewed By: will

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13735
  • Loading branch information
Ashoat committed Oct 17, 2024
1 parent 430e3ad commit 2ba2d1a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/utils/farcaster-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import invariant from 'invariant';
import * as React from 'react';

import {
setSyncedMetadataEntryActionType,
clearSyncedMetadataEntryActionType,
} from '../actions/synced-metadata-actions.js';
import { setSyncedMetadataEntryActionType } from '../actions/synced-metadata-actions.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
import { syncedMetadataNames } from '../types/synced-metadata-types.js';
import { useSelector, useDispatch } from '../utils/redux-utils.js';
Expand Down Expand Up @@ -71,9 +68,10 @@ function useUnlinkFID(): () => Promise<void> {
await unlinkFarcasterAccount();

dispatch({
type: clearSyncedMetadataEntryActionType,
type: setSyncedMetadataEntryActionType,
payload: {
name: syncedMetadataNames.CURRENT_USER_FID,
data: NO_FID_METADATA,
},
});
}, [dispatch, unlinkFarcasterAccount]);
Expand Down

0 comments on commit 2ba2d1a

Please sign in to comment.