@@ -14,18 +14,14 @@ export function setupAppErrorHandle(app: App) {
14
14
const UPDATE_CHECK_INTERVAL = 3 * 60 * 1000 ;
15
15
16
16
export function setupAppVersionNotification ( ) {
17
- const canAutoUpdateApp = import . meta. env . VITE_AUTOMATICALLY_DETECT_UPDATE === 'Y' ;
18
-
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
@@ -47,6 +43,7 @@ export function setupAppVersionNotification() {
47
43
{
48
44
onClick ( ) {
49
45
n ?. destroy ( ) ;
46
+ isShow = false ;
50
47
}
51
48
} ,
52
49
( ) => $t ( 'system.updateCancel' )
@@ -77,7 +74,7 @@ export function setupAppVersionNotification() {
77
74
} ;
78
75
79
76
// If updates should be checked, set up the visibility change listener and start the update interval
80
- if ( shouldCheckForUpdates ) {
77
+ if ( ! isShow && document . visibilityState === 'visible' ) {
81
78
// Check for updates when the document is visible
82
79
document . addEventListener ( 'visibilitychange' , ( ) => {
83
80
if ( document . visibilityState === 'visible' ) {
0 commit comments