Profile follow client events (#9385)

* Add parameters to profile:follow

Track who was followed, whose profile generated the follow, and the position of the person who was followed in the list

* Add profileCard:seen event

* Don't send "profileCard:seen" event to Statsig

* Clean up

* prevent overzealous clearing

---------

Co-authored-by: Samuel Newman <mozzius@protonmail.com>
This commit is contained in:
Alex Benzer
2025-11-17 05:04:11 -08:00
committed by GitHub
parent 2f678a3ccd
commit 084f60c88f
6 changed files with 125 additions and 3 deletions
+13 -1
View File
@@ -242,12 +242,19 @@ export function useProfileFollowMutationQueue(
profile: Shadow<bsky.profile.AnyProfileView>,
logContext: LogEvents['profile:follow']['logContext'] &
LogEvents['profile:follow']['logContext'],
position?: number,
contextProfileDid?: string,
) {
const agent = useAgent()
const queryClient = useQueryClient()
const did = profile.did
const initialFollowingUri = profile.viewer?.following
const followMutation = useProfileFollowMutation(logContext, profile)
const followMutation = useProfileFollowMutation(
logContext,
profile,
position,
contextProfileDid,
)
const unfollowMutation = useProfileUnfollowMutation(logContext)
const queueToggle = useToggleMutationQueue({
@@ -314,6 +321,8 @@ export function useProfileFollowMutationQueue(
function useProfileFollowMutation(
logContext: LogEvents['profile:follow']['logContext'],
profile: Shadow<bsky.profile.AnyProfileView>,
position?: number,
contextProfileDid?: string,
) {
const {currentAccount} = useSession()
const agent = useAgent()
@@ -336,7 +345,10 @@ function useProfileFollowMutation(
'followersCount' in profile
? toClout(profile.followersCount)
: undefined,
followeeDid: did,
followerClout: toClout(ownProfile?.followersCount),
position,
contextProfileDid,
})
return await agent.follow(did)
},