fix(mcp): 修复 ConfigCard use_effect 死循环

use_effect 内读 loading() 作为重入 guard,使 loading 成为响应式依赖:
effect 设 loading=true → loading 变化触发 effect 重跑 → 早退;
fetch 完成设 loading=false → loading 变化再次触发 effect → 再次跑,
无限循环,导致 /api/get_mcp_client_configs 被疯狂调用。

use_effect 本身按依赖去重,config_token 不变就不会重跑,guard 多余;
删掉 effect 内的 loading() 读取,loading 不再是依赖,循环解除。
(on_manual_input 内的 loading 读取在事件闭包里,不构成响应式订阅,保留。)
This commit is contained in:
xfy 2026-07-28 14:57:40 +08:00
parent 1d1b32cdd2
commit 063ad6e606

View File

@ -452,7 +452,6 @@ fn ConfigCard() -> Element {
use_effect(move || {
let token = config_token();
let Some(t) = token else { return; };
if loading() { return; }
loading.set(true);
manual_token.set(t.clone());
spawn(async move {