Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Session] Fix stale emailAuthFactor and emailConfirmed on the client (#3835)

* Fix account refresh to not clobber falsy values

* Use ?? in more places

authored by

dan and committed by
GitHub
c13685a0 0f827c32

+11 -15
+11 -15
src/state/session/index.tsx
··· 121 121 // TODO: use agentToSessionAccount for this too. 122 122 const refreshedAccount: SessionAccount = { 123 123 service: account.service, 124 - did: session?.did || account.did, 125 - handle: session?.handle || account.handle, 126 - email: session?.email || account.email, 127 - emailConfirmed: session?.emailConfirmed || account.emailConfirmed, 128 - emailAuthFactor: session?.emailAuthFactor || account.emailAuthFactor, 124 + did: session?.did ?? account.did, 125 + handle: session?.handle ?? account.handle, 126 + email: session?.email ?? account.email, 127 + emailConfirmed: session?.emailConfirmed ?? account.emailConfirmed, 128 + emailAuthFactor: session?.emailAuthFactor ?? account.emailAuthFactor, 129 129 deactivated: isSessionDeactivated(session?.accessJwt), 130 130 pdsUrl: agent.pdsUrl?.toString(), 131 131 ··· 311 311 isSessionDeactivated(account.accessJwt) || account.deactivated 312 312 313 313 const prevSession = { 314 - accessJwt: account.accessJwt || '', 315 - refreshJwt: account.refreshJwt || '', 314 + accessJwt: account.accessJwt ?? '', 315 + refreshJwt: account.refreshJwt ?? '', 316 316 did: account.did, 317 317 handle: account.handle, 318 318 } ··· 457 457 458 458 const updatedAccount = { 459 459 ...currentAccount, 460 - handle: account.handle || currentAccount.handle, 461 - email: account.email || currentAccount.email, 460 + handle: account.handle ?? currentAccount.handle, 461 + email: account.email ?? currentAccount.email, 462 462 emailConfirmed: 463 - account.emailConfirmed !== undefined 464 - ? account.emailConfirmed 465 - : currentAccount.emailConfirmed, 463 + account.emailConfirmed ?? currentAccount.emailConfirmed, 466 464 emailAuthFactor: 467 - account.emailAuthFactor !== undefined 468 - ? account.emailAuthFactor 469 - : currentAccount.emailAuthFactor, 465 + account.emailAuthFactor ?? currentAccount.emailAuthFactor, 470 466 } 471 467 472 468 return {