diff --git a/lib/actions/aux-user-actions.js b/lib/actions/aux-user-actions.js --- a/lib/actions/aux-user-actions.js +++ b/lib/actions/aux-user-actions.js @@ -2,4 +2,6 @@ const setFarcasterFriendsFIDActionType = 'SET_FARCASTER_FRIENDS_FID'; -export { setFarcasterFriendsFIDActionType }; +const clearFarcasterFriendsFIDActionType = 'CLEAR_FARCASTER_FRIENDS_FID'; + +export { setFarcasterFriendsFIDActionType, clearFarcasterFriendsFIDActionType }; diff --git a/lib/reducers/aux-user-reducer.js b/lib/reducers/aux-user-reducer.js --- a/lib/reducers/aux-user-reducer.js +++ b/lib/reducers/aux-user-reducer.js @@ -1,6 +1,9 @@ // @flow -import { setFarcasterFriendsFIDActionType } from '../actions/aux-user-actions.js'; +import { + setFarcasterFriendsFIDActionType, + clearFarcasterFriendsFIDActionType, +} from '../actions/aux-user-actions.js'; import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js'; import { auxUserStoreOpsHandlers, @@ -33,6 +36,27 @@ }, }); } + return { + auxUserStore: processStoreOps(state, replaceOperations), + auxUserStoreOperations: replaceOperations, + }; + } else if (action.type === clearFarcasterFriendsFIDActionType) { + const replaceOperations: ReplaceAuxUserInfoOperation[] = []; + for (const userID in state.auxUserInfos) { + if (state.auxUserInfos[userID].fid !== null) { + replaceOperations.push({ + type: 'replace_aux_user_info', + payload: { + id: userID, + auxUserInfo: { + ...state.auxUserInfos[userID], + fid: null, + }, + }, + }); + } + } + return { auxUserStore: processStoreOps(state, replaceOperations), auxUserStoreOperations: replaceOperations, diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js --- a/lib/types/redux-types.js +++ b/lib/types/redux-types.js @@ -1388,6 +1388,10 @@ +type: 'SET_FARCASTER_FRIENDS_FID', +payload: SetFarcasterFriendsFIDPayload, } + | { + +type: 'CLEAR_FARCASTER_FRIENDS_FID', + +payload?: void, + } | { +type: 'OPS_PROCESSING_FINISHED_ACTION_TYPE', +payload?: void,