@@ -107,6 +107,7 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
107107
108108 const wallets = useWatch ( account , 'currencyWallets' )
109109 const otpKey = useWatch ( account , 'otpKey' )
110+ const username = useWatch ( account , 'username' )
110111
111112 const detectedTokensRedux = useSelector (
112113 state => state . core . enabledDetectedTokens
@@ -124,7 +125,7 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
124125 // we only need referral-based promoId targeting.
125126 const accountFunded = useIsAccountFunded ( )
126127
127- const isLightAccountReminder = account . id != null && account . username == null
128+ const isLightAccountReminder = account . id != null && username == null
128129
129130 const isOtpReminder =
130131 otpKey == null &&
@@ -146,6 +147,8 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
146147 // Update notification info with
147148 // 1. Date last received if transitioning from incomplete to complete
148149 // 2. Reset `isBannerHidden` if it's a new notification
150+ // All notification writes are in a single effect with sequential awaits to
151+ // prevent race conditions between concurrent writes.
149152 useAsyncEffect (
150153 async ( ) => {
151154 // New token(s) detected
@@ -165,11 +168,6 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
165168 }
166169
167170 await updateNotificationInfo ( account , 'ip2FaReminder' , isIp2faReminder )
168- await updateNotificationInfo (
169- account ,
170- 'lightAccountReminder' ,
171- isLightAccountReminder
172- )
173171 await updateNotificationInfo (
174172 account ,
175173 'otpReminder' ,
@@ -198,6 +196,33 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
198196 )
199197 }
200198 }
199+
200+ // Handle lightAccountReminder separately using writeAccountNotifInfo
201+ // directly (not updateNotificationInfo) to ensure isBannerHidden is
202+ // always reset to false on login. This is placed last to avoid race
203+ // conditions with other notification writes above.
204+ if ( isLightAccountReminder ) {
205+ // Light account: always show the backup reminder banner on login
206+ await writeAccountNotifInfo ( account , 'lightAccountReminder' , {
207+ isPriority : true ,
208+ isBannerHidden : false ,
209+ isCompleted : false
210+ } )
211+ } else {
212+ // Non-light account: mark complete if notification exists and isn't
213+ // already complete (handles upgrade from light account)
214+ const { notifState : currentNotifState } = await getLocalAccountSettings (
215+ account
216+ )
217+ const existing = currentNotifState . lightAccountReminder
218+ if ( existing != null && ! existing . isCompleted ) {
219+ await writeAccountNotifInfo ( account , 'lightAccountReminder' , {
220+ isPriority : true ,
221+ isBannerHidden : true ,
222+ isCompleted : true
223+ } )
224+ }
225+ }
201226 } ,
202227 [
203228 isIp2faReminder ,
@@ -206,7 +231,6 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
206231 isPwReminder ,
207232 wallets ,
208233 detectedTokensRedux ,
209- notifState ,
210234 accountReferral ,
211235 accountReferralLoaded ,
212236 countryCode ,
@@ -215,21 +239,5 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
215239 'NotificationServices'
216240 )
217241
218- // Make sure the backup banner is always shown on login if needed. We do this
219- // separately in this effect so that we can hide the banner during current
220- // login session if they so choose.
221- useAsyncEffect (
222- async ( ) => {
223- if ( ! isLightAccountReminder ) return
224-
225- await writeAccountNotifInfo ( account , 'lightAccountReminder' , {
226- isBannerHidden : false ,
227- isCompleted : false
228- } )
229- } ,
230- [ isLightAccountReminder ] ,
231- 'NotificationServices'
232- )
233-
234242 return null
235243}
0 commit comments