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
This commit is contained in:
dan
2024-11-16 21:39:47 +00:00
committed by GitHub
parent 9bbea3f33a
commit edaf230612
3 changed files with 33 additions and 151 deletions
+23 -18
View File
@@ -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