fix: 清理前端异步请求生命周期

- 页面卸载和弹窗关闭时终止 SSE

- 为版本检查增加超时、中止与重复请求保护
This commit is contained in:
2026-07-27 19:41:48 +08:00
parent a904f63ec8
commit 908eb5583d
6 changed files with 125 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ChatTimeTimelineItem } from '@easyflow/types';
import { inject, ref } from 'vue';
import { inject, onBeforeUnmount, ref } from 'vue';
import { ChatTimeTimelineBuilder, uuid } from '@easyflow/utils';
@@ -237,6 +237,12 @@ function normalizeSseRoundMeta(meta: any): SseRoundMeta {
variantIndex,
};
}
onBeforeUnmount(() => {
if (btnLoading.value) {
stopSse();
}
});
</script>
<template>