From 58f1e87457c7571d5cb79016f38069d333e99ed9 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 5 Feb 2025 11:26:48 -0600 Subject: [PATCH] Clean up upsertProfile types --- src/screens/Onboarding/StepFinished.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/screens/Onboarding/StepFinished.tsx b/src/screens/Onboarding/StepFinished.tsx index bf6d984f77..1e1c6aacd8 100644 --- a/src/screens/Onboarding/StepFinished.tsx +++ b/src/screens/Onboarding/StepFinished.tsx @@ -1,6 +1,11 @@ import React from 'react' import {View} from 'react-native' -import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api' +import { + AppBskyActorProfile, + AppBskyGraphDefs, + AppBskyGraphStarterpack, + Un$Typed, +} from '@atproto/api' import {SavedFeed} from '@atproto/api/dist/client/types/app/bsky/actor/defs' import {TID} from '@atproto/common-web' import {msg, Trans} from '@lingui/macro' @@ -142,29 +147,29 @@ export function StepFinished() { : undefined await agent.upsertProfile(async existing => { - existing = existing ?? {} + let next: Un$Typed = existing ?? {} if (blobPromise) { const res = await blobPromise if (res.data.blob) { - existing.avatar = res.data.blob + next.avatar = res.data.blob } } if (starterPack) { - existing.joinedViaStarterPack = { + next.joinedViaStarterPack = { uri: starterPack.uri, cid: starterPack.cid, } } - existing.displayName = '' + next.displayName = '' // HACKFIX // creating a bunch of identical profile objects is breaking the relay // tossing this unspecced field onto it to reduce the size of the problem // -prf - existing.createdAt = new Date().toISOString() - return existing + next.createdAt = new Date().toISOString() + return next }) logEvent('onboarding:finished:avatarResult', {