[FIX] Reload app due to extension only on app update #1261
+79
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a new approach from #1249.
It now checks everything only on the main process and has no issues with MM profile import.
AI Summary
This pull request includes several changes to the
src/backend/main.ts
andsrc/common/types/electron_store.ts
files to handle app version updates and wallet connection state management. The most important changes include adding version checks, updating wallet connection state, and modifying the store structure to include new properties.Version checks and updates:
src/backend/main.ts
: Added code to check and log app version changes, and update the stored app version inconfigStore
.src/backend/main.ts
: Modified the logic to reload the app if the wallet is not connected or if the app version has changed.Wallet connection state management:
src/backend/main.ts
: Added event handlers for wallet connection, disconnection, chain changes, and account changes. These handlers update theconfigStore
with the wallet state and notify the renderer process.Store structure updates:
src/common/types/electron_store.ts
: AddedappVersion
property to theconfigStore
structure.src/common/types/electron_store.ts
: AddedwalletState
property to theconfigStore
structure to store wallet connection status, address, and provider.Use the following Checklist if you have changed something on the Backend or Frontend: