fix: 清理前端异步请求生命周期
- 页面卸载和弹窗关闭时终止 SSE - 为版本检查增加超时、中止与重复请求保护
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user