@@ -10,22 +10,18 @@ export function setupAppErrorHandle(app: App) {
10
10
} ;
11
11
}
12
12
13
- // Update check interval in milliseconds
14
- const UPDATE_CHECK_INTERVAL = 3 * 60 * 1000 ;
15
-
16
13
export function setupAppVersionNotification ( ) {
17
- const canAutoUpdateApp = import . meta. env . VITE_AUTOMATICALLY_DETECT_UPDATE === 'Y' ;
14
+ // Update check interval in milliseconds
15
+ const UPDATE_CHECK_INTERVAL = 3 * 60 * 1000 ;
18
16
17
+ const canAutoUpdateApp = import . meta. env . VITE_AUTOMATICALLY_DETECT_UPDATE === 'Y' && import . meta. env . PROD ;
19
18
if ( ! canAutoUpdateApp ) return ;
20
19
21
20
let isShow = false ;
22
21
let updateInterval : ReturnType < typeof setInterval > | undefined ;
23
22
24
- // Check if updates should be checked
25
- const shouldCheckForUpdates = [ ! isShow , document . visibilityState === 'visible' , ! import . meta. env . DEV ] . every ( Boolean ) ;
26
-
27
23
const checkForUpdates = async ( ) => {
28
- if ( ! shouldCheckForUpdates ) return ;
24
+ if ( isShow ) return ;
29
25
30
26
const buildTime = await getHtmlBuildTime ( ) ;
31
27
@@ -49,6 +45,7 @@ export function setupAppVersionNotification() {
49
45
{
50
46
onClick ( ) {
51
47
window . $notification ?. destroy ( key ) ;
48
+ isShow = false ;
52
49
}
53
50
} ,
54
51
( ) => $t ( 'system.updateCancel' )
@@ -79,7 +76,7 @@ export function setupAppVersionNotification() {
79
76
} ;
80
77
81
78
// If updates should be checked, set up the visibility change listener and start the update interval
82
- if ( shouldCheckForUpdates ) {
79
+ if ( ! isShow && document . visibilityState === 'visible' ) {
83
80
// Check for updates when the document is visible
84
81
document . addEventListener ( 'visibilitychange' , ( ) => {
85
82
if ( document . visibilityState === 'visible' ) {
0 commit comments