diff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts index f2507a28d576..2280f6cdc0f5 100644 --- a/src/libs/actions/User.ts +++ b/src/libs/actions/User.ts @@ -779,6 +779,13 @@ function generateStatementPDF(period: string) { function setContactMethodAsDefault(newDefaultContactMethod: string) { const oldDefaultContactMethod = currentEmail; const optimisticData: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + primaryLogin: newDefaultContactMethod, + }, + }, { onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.SESSION, @@ -825,6 +832,13 @@ function setContactMethodAsDefault(newDefaultContactMethod: string) { }, ]; const failureData: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + primaryLogin: oldDefaultContactMethod, + }, + }, { onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.SESSION,