Skip to content

Commit 178ffd3

Browse files
committed
Fix light account/backup notification banner display behavior
1 parent 69df3fd commit 178ffd3

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- added: Zcash buy/sell support with Banxa
1111
- changed: Optimize login performance.
1212
- changed: Update Monero LWS server name to "Edge LWS"
13+
- fixed: Light account/backup reminder notification banner sometimes missing on login
1314

1415
## 4.41.1 (2025-12-29)
1516

src/actions/LocalSettingsActions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ export const writeTokenWarningsShown = async (
261261
export const readLocalAccountSettings = async (
262262
account: EdgeAccount
263263
): Promise<LocalAccountSettings> => {
264+
// If we've already read from disk, return the cached settings.
265+
// This prevents stale disk reads from overwriting newer in-memory writes
266+
// that may not have been persisted to disk yet.
267+
if (readSettingsFromDisk) {
268+
return localAccountSettings
269+
}
270+
264271
try {
265272
const text = await account.localDisklet.getText(LOCAL_SETTINGS_FILENAME)
266273
const json = JSON.parse(text)
@@ -273,6 +280,7 @@ export const readLocalAccountSettings = async (
273280
// Defaults can be derived from cleaners. Only write when values change.
274281
const defaults = asLocalAccountSettings({})
275282
emitAccountSettings(defaults)
283+
readSettingsFromDisk = true
276284
return defaults
277285
}
278286
}

src/components/services/NotificationService.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
146146
// Update notification info with
147147
// 1. Date last received if transitioning from incomplete to complete
148148
// 2. Reset `isBannerHidden` if it's a new notification
149+
// NOTE: lightAccountReminder is handled by a separate effect below to
150+
// avoid race conditions.
149151
useAsyncEffect(
150152
async () => {
151153
// New token(s) detected
@@ -165,11 +167,6 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
165167
}
166168

167169
await updateNotificationInfo(account, 'ip2FaReminder', isIp2faReminder)
168-
await updateNotificationInfo(
169-
account,
170-
'lightAccountReminder',
171-
isLightAccountReminder
172-
)
173170
await updateNotificationInfo(
174171
account,
175172
'otpReminder',
@@ -201,12 +198,10 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
201198
},
202199
[
203200
isIp2faReminder,
204-
isLightAccountReminder,
205201
isOtpReminder,
206202
isPwReminder,
207203
wallets,
208204
detectedTokensRedux,
209-
notifState,
210205
accountReferral,
211206
accountReferralLoaded,
212207
countryCode,
@@ -215,9 +210,11 @@ export const NotificationService: React.FC<Props> = (props: Props) => {
215210
'NotificationServices'
216211
)
217212

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.
213+
// Make sure the backup banner is always shown on login if needed. This is
214+
// kept as a separate effect with minimal dependencies to avoid race
215+
// conditions with the effect above. The dependency on isLightAccountReminder
216+
// (which only changes at login) ensures this runs once per login.
217+
// Users can still hide the banner during the current login session.
221218
useAsyncEffect(
222219
async () => {
223220
if (!isLightAccountReminder) return

0 commit comments

Comments
 (0)