fix email not updating in session state after email change

This commit is contained in:
vineyardbovines
2026-02-25 15:42:20 -05:00
committed by Samuel Newman
parent 9746dd8e4c
commit 9ec3f4b6a3
5 changed files with 29 additions and 11 deletions
+6 -1
View File
@@ -58,7 +58,10 @@ export type Action =
| {
type: 'partial-refresh-session'
accountDid: string
patch: Pick<SessionAccount, 'emailConfirmed' | 'emailAuthFactor'>
patch: Pick<
SessionAccount,
'email' | 'emailConfirmed' | 'emailAuthFactor'
>
}
function createPublicAgentState(): AgentState {
@@ -239,6 +242,7 @@ let reducer = (state: State, action: Action): State => {
* Only mutating values that are safe. Be very careful with this.
*/
if (agent.session) {
agent.session.email = patch.email ?? agent.session.email
agent.session.emailConfirmed =
patch.emailConfirmed ?? agent.session.emailConfirmed
agent.session.emailAuthFactor =
@@ -255,6 +259,7 @@ let reducer = (state: State, action: Action): State => {
if (a.did === accountDid) {
return {
...a,
email: patch.email ?? a.email,
emailConfirmed: patch.emailConfirmed ?? a.emailConfirmed,
emailAuthFactor: patch.emailAuthFactor ?? a.emailAuthFactor,
}