mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-01 03:37:19 +08:00
fix: Fix dashboard refresh exception issue (#9429)
This commit is contained in:
parent
3f26412585
commit
997b706d8a
1 changed files with 12 additions and 7 deletions
|
|
@ -279,6 +279,7 @@ let timer: NodeJS.Timer | null = null;
|
|||
let isInit = ref<boolean>(true);
|
||||
let isStatusInit = ref<boolean>(true);
|
||||
let isActive = ref(true);
|
||||
let isCurrentActive = ref(true);
|
||||
|
||||
const ioReadBytes = ref<Array<number>>([]);
|
||||
const ioWriteBytes = ref<Array<number>>([]);
|
||||
|
|
@ -406,16 +407,19 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => {
|
|||
statusRef.value?.acceptParams(currentInfo.value, baseInfo.value);
|
||||
appRef.value?.acceptParams();
|
||||
if (isInit) {
|
||||
try {
|
||||
timer = setInterval(async () => {
|
||||
timer = setInterval(async () => {
|
||||
try {
|
||||
if (!isCurrentActive.value) {
|
||||
throw new Error('jump out');
|
||||
}
|
||||
if (isActive.value && !globalStore.isOnRestart) {
|
||||
await onLoadCurrentInfo();
|
||||
}
|
||||
}, 3000);
|
||||
} finally {
|
||||
clearInterval(Number(timer));
|
||||
timer = null;
|
||||
}
|
||||
} catch {
|
||||
clearInterval(Number(timer));
|
||||
timer = null;
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -554,6 +558,7 @@ onMounted(() => {
|
|||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('focus', onFocus);
|
||||
window.removeEventListener('blur', onBlur);
|
||||
isCurrentActive.value = false;
|
||||
clearInterval(Number(timer));
|
||||
timer = null;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue