diff options
author | dan <dan.abramov@gmail.com> | 2024-11-16 21:39:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-16 21:39:47 +0000 |
commit | edaf230612f688512c71a66a99742e558620ebd3 (patch) | |
tree | 68840eeb473dd77c0f040bd6fa206c9ad2961a75 /src/screens/Onboarding/StepFinished.tsx | |
parent | 9bbea3f33a9a17285d8ec58003b598a911c192a1 (diff) | |
download | voidsky-edaf230612f688512c71a66a99742e558620ebd3.tar.zst |
Remove typography NUX and consistently call upsertProfile (#6424)
* Make profile upsert unconditional * Remove Typography NUX * Early exit NUXes on unknown creation date * Clarify via comment
Diffstat (limited to 'src/screens/Onboarding/StepFinished.tsx')
-rw-r--r-- | src/screens/Onboarding/StepFinished.tsx | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/screens/Onboarding/StepFinished.tsx b/src/screens/Onboarding/StepFinished.tsx index fdc0a3eb7..0d8971b6f 100644 --- a/src/screens/Onboarding/StepFinished.tsx +++ b/src/screens/Onboarding/StepFinished.tsx @@ -127,31 +127,36 @@ export function StepFinished() { })(), (async () => { const {imageUri, imageMime} = profileStepResults - if (imageUri && imageMime) { - const blobPromise = uploadBlob(agent, imageUri, imageMime) - await agent.upsertProfile(async existing => { - existing = existing ?? {} + const blobPromise = + imageUri && imageMime + ? uploadBlob(agent, imageUri, imageMime) + : undefined + + await agent.upsertProfile(async existing => { + existing = existing ?? {} + + if (blobPromise) { const res = await blobPromise if (res.data.blob) { existing.avatar = res.data.blob } + } - if (starterPack) { - existing.joinedViaStarterPack = { - uri: starterPack.uri, - cid: starterPack.cid, - } + if (starterPack) { + existing.joinedViaStarterPack = { + uri: starterPack.uri, + cid: starterPack.cid, } + } - existing.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 - }) - } + existing.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 + }) logEvent('onboarding:finished:avatarResult', { avatarResult: profileStepResults.isCreatedAvatar |