Skip to content

fix: clear stale custom wallet icon references#4079

Draft
shubhamkmr04 wants to merge 2 commits into
ZeusLN:masterfrom
shubhamkmr04:fix/custom-wallet-icon-sync-issue
Draft

fix: clear stale custom wallet icon references#4079
shubhamkmr04 wants to merge 2 commits into
ZeusLN:masterfrom
shubhamkmr04:fix/custom-wallet-icon-sync-issue

Conversation

@shubhamkmr04
Copy link
Copy Markdown
Contributor

@shubhamkmr04 shubhamkmr04 commented May 11, 2026

Description

Relates to issue: #4042

Custom wallet photos are stored as device-local files in DocumentDirectoryPath and referenced as rnfs://<filename> in node settings. These files only exist on the device that originally picked the photo. If an rnfs:// reference makes its way into another device's settings (e.g. via an iCloud backup restore, or a legacy iCloud Keychain sync from an older Zeus version), the UI tries to load a file that doesn't exist, resulting in a broken/missing wallet icon

Reproduction note

We were unable to reproduce the original bug on a fresh install of the current build (physical iPhone + iOS Simulator, same Apple ID) because the migration to cloudSync: false for keychain storage already prevents new cross-device sync. The bug might be specific to users who upgraded to the latest build from older Zeus versions where settings
were synced via iCloud Keychain.

What this PR does

  • Adds a photoExists() helper in PhotoUtils to check whether the file behind an rnfs:// reference is actually present on disk.
  • Adds cleanupMissingNodePhotos() to SettingsStore.getSettings(). On every settings load, it scans each node's photo field and clears any rnfs:// reference whose file is missing, so the UI falls back to NodeIdenticon instead of rendering a broken image.

This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Configuration change
  • Locales update
  • Quality assurance
  • Other

Checklist

  • I’ve run yarn run tsc and made sure my code compiles correctly
  • I’ve run yarn run lint and made sure my code didn’t contain any problematic patterns
  • I’ve run yarn run prettier and made sure my code is formatted correctly
  • I’ve run yarn run test and made sure all of the tests pass

Testing

If you modified or added a utility file, did you add new unit tests?

  • No, I’m a fool
  • Yes
  • N/A

I have tested this PR on the following platforms (please specify OS version and phone model/VM):

  • Android
  • iOS

I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):

On-device

  • LDK Node
  • Embedded LND

Remote

  • LND (REST)
  • LND (Lightning Node Connect)
  • Core Lightning (CLNRest)
  • Nostr Wallet Connect
  • LndHub

Locales

  • I’ve added new locale text that requires translations
  • I’m aware that new translations should be made on the ZEUS Transfix page and not directly to this repo

Third Party Dependencies and Packages

  • Contributors will need to run yarn after this PR is merged in
  • 3rd party dependencies have been modified:
    • verify that package.json and yarn.lock have been properly updated
    • verify that dependencies are installed for both iOS and Android platforms

Other:

  • Changes were made that require an update to the README
  • Changes were made that require an update to onboarding

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a cleanup mechanism for node photos in the SettingsStore. It adds a photoExists utility to verify the existence of local files referenced by rnfs:// URIs and clears references to missing files during the settings loading process to prevent broken images in the UI. Feedback was provided to wrap state modifications within runInAction to comply with MobX best practices for asynchronous updates.

Comment thread stores/SettingsStore.ts
@shubhamkmr04 shubhamkmr04 force-pushed the fix/custom-wallet-icon-sync-issue branch from c31adf8 to e81d0a3 Compare May 11, 2026 13:05
@kaloudis kaloudis added Bug Something isn't working Storage Local device storage labels May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Storage Local device storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants