fix: 优化前端生命周期清理与本地文件忽略

- 修复流程提交组件 props 默认值返回 undefined 的问题
- 清理调试日志和空生命周期钩子
- 修复 TagsView 滚动监听移除参数不一致
- 补充消息推送 SSE watcher 清理
- 补充缓存监控页 ECharts 实例和 resize 监听清理
- 忽略 IDE 模块文件并纳入 pnpm lockfile
This commit is contained in:
疯狂的狮子Li
2026-06-08 17:52:31 +08:00
parent 62694b1554
commit d74c18e58e
6 changed files with 4633 additions and 65 deletions

View File

@@ -8,6 +8,7 @@ import { isMessageRead } from '@/utils/message-read';
import { parsePushMessage, resolveNoticeGroup, resolveNoticeTitle, shouldAppendNotice } from '@/utils/push-message';
let closePushConnection: (() => void) | undefined;
let stopPushWatchers: Array<() => void> = [];
const formatNoticeTime = (timestamp?: number | string) => {
const time = timestamp ? new Date(timestamp) : new Date();
@@ -77,22 +78,23 @@ const initSsePush = (url: string) => {
retries: 5,
delay: 5000,
onFailed() {
console.log('Failed to connect after 5 retries');
console.warn('SSE connection failed after 5 retries');
}
}
});
closePushConnection = close;
watch(error, () => {
console.log('SSE connection error:', error.value);
const stopErrorWatch = watch(error, () => {
console.warn('SSE connection error:', error.value);
error.value = null;
});
watch(data, () => {
const stopDataWatch = watch(data, () => {
if (!data.value) return;
appendNotice(data.value);
data.value = null;
});
stopPushWatchers.push(stopErrorWatch, stopDataWatch);
};
const initWsPush = (url: string) => {
@@ -101,7 +103,7 @@ const initWsPush = (url: string) => {
retries: 3,
delay: 1000,
onFailed() {
console.log('websocket重连失败');
console.warn('websocket重连失败');
}
},
heartbeat: {
@@ -109,12 +111,6 @@ const initWsPush = (url: string) => {
interval: 10000,
pongTimeout: 2000
},
onConnected() {
console.log('websocket已经连接');
},
onDisconnected() {
console.log('websocket已经断开');
},
onMessage: (_, e) => {
if (String(e.data) === 'pong') {
return;
@@ -154,4 +150,6 @@ export const initMessageBox = async () => {
export const closePush = () => {
closePushConnection?.();
closePushConnection = undefined;
stopPushWatchers.forEach(stop => stop());
stopPushWatchers = [];
};