@@ -14,18 +14,14 @@ export function setupAppErrorHandle(app: App) {
1414const UPDATE_CHECK_INTERVAL = 3 * 60 * 1000 ;
1515
1616export 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 ;
1918 if ( ! canAutoUpdateApp ) return ;
2019
2120 let isShow = false ;
2221 let updateInterval : ReturnType < typeof setInterval > | undefined ;
2322
24- // Check if updates should be checked
25- const shouldCheckForUpdates = [ ! isShow , document . visibilityState === 'visible' , ! import . meta. env . DEV ] . every ( Boolean ) ;
26-
2723 const checkForUpdates = async ( ) => {
28- if ( ! shouldCheckForUpdates ) return ;
24+ if ( isShow ) return ;
2925
3026 const buildTime = await getHtmlBuildTime ( ) ;
3127
@@ -47,6 +43,7 @@ export function setupAppVersionNotification() {
4743 {
4844 onClick ( ) {
4945 n ?. destroy ( ) ;
46+ isShow = false ;
5047 }
5148 } ,
5249 ( ) => $t ( 'system.updateCancel' )
@@ -77,7 +74,7 @@ export function setupAppVersionNotification() {
7774 } ;
7875
7976 // 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' ) {
8178 // Check for updates when the document is visible
8279 document . addEventListener ( 'visibilitychange' , ( ) => {
8380 if ( document . visibilityState === 'visible' ) {
0 commit comments