From 1bf7b23f75fb2d0d51557416725d2ea76efac923 Mon Sep 17 00:00:00 2001 From: Supra4E8C Date: Fri, 27 Mar 2026 22:01:40 +0800 Subject: [PATCH] fix(config): invalidate in-flight fetch on section updates --- src/stores/useConfigStore.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/stores/useConfigStore.ts b/src/stores/useConfigStore.ts index da8f2a0..b97a36d 100644 --- a/src/stores/useConfigStore.ts +++ b/src/stores/useConfigStore.ts @@ -267,7 +267,12 @@ export const useConfigStore = create((set, get) => ({ // 同时清除完整配置缓存 newCache.delete('__full__'); - set({ cache: newCache }); + // Section-level invalidation usually follows an optimistic write path. Invalidate any in-flight + // full fetch so stale responses can't overwrite newer local changes. + configRequestToken += 1; + inFlightConfigRequest = null; + + set({ cache: newCache, loading: false, error: null }); return; } else { newCache.clear();