优化节点加载逻辑
This commit is contained in:
parent
38136f59bf
commit
cff0ad3dff
@ -26,8 +26,6 @@ async function refreshNodeList() {
|
||||
ALL_NODE_TYPES.value = getAllNodeTypes();
|
||||
}
|
||||
|
||||
let checkInterval = null;
|
||||
|
||||
// 异步加载节点元数据
|
||||
onMounted(async () => {
|
||||
await refreshNodeList();
|
||||
@ -35,10 +33,6 @@ onMounted(async () => {
|
||||
// 监听节点更新事件,当新节点安装后自动刷新
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('nodeMetadataUpdated', refreshNodeList);
|
||||
// 定期检查节点更新(每30秒,作为备用机制)
|
||||
checkInterval = setInterval(() => {
|
||||
refreshNodeList();
|
||||
}, 30000);
|
||||
}
|
||||
});
|
||||
|
||||
@ -46,9 +40,6 @@ onMounted(async () => {
|
||||
onUnmounted(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.removeEventListener('nodeMetadataUpdated', refreshNodeList);
|
||||
if (checkInterval) {
|
||||
clearInterval(checkInterval);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user