File tree 1 file changed +9
-4
lines changed
src/frontend/components/UI/AppVersion
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useEffect , useState } from 'react'
2
2
3
3
const storage = window . localStorage
4
- let lastVersion = storage . getItem ( 'last_version' ) ?. replaceAll ( '"' , '' )
5
- if ( lastVersion === undefined ) {
6
- lastVersion = ''
7
- }
4
+ const lastVersion = storage . getItem ( 'last_version' ) ?. replaceAll ( '"' , '' )
8
5
9
6
export default function AppVersion ( ) {
10
7
const [ appVersion , setAppVersion ] = useState ( lastVersion )
11
8
12
9
useEffect ( ( ) => {
13
10
window . api . getAppVersion ( ) . then ( ( version ) => {
11
+ if ( version !== lastVersion ) {
12
+ window . api . logInfo (
13
+ `Updated to a new version, reloading the MetaMask extension. Old version: ${ lastVersion } , new version: ${ version } `
14
+ )
15
+ window . api . reloadForMM ( )
16
+ } else {
17
+ window . api . logInfo ( 'No new version detected. Wont reload the app' )
18
+ }
14
19
storage . setItem ( 'last_version' , JSON . stringify ( version ) )
15
20
setAppVersion ( version )
16
21
} )
You can’t perform that action at this time.
0 commit comments