From 740bc675e8dd59518533bb44d6f2c369be516517 Mon Sep 17 00:00:00 2001 From: Shawn Date: Tue, 19 May 2026 16:00:28 +0800 Subject: [PATCH] fix(app): invalidate provider queries after config update to show custom providers immediately When users configure a custom provider via the Desktop UI, the newly added provider does not appear in the available provider list until the app is restarted. This happens because updateConfigMutation's onSuccess only calls bootstrap.refetch(), which does not invalidate per-directory provider queries in child stores. This fix adds queryClient.invalidateQueries() calls to clear all provider caches (both global and per-directory) after a successful config update, ensuring custom providers appear immediately in the model selection list. Fixes #24818 --- packages/app/src/context/global-sync.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/app/src/context/global-sync.tsx b/packages/app/src/context/global-sync.tsx index 594f94fb6218..96c4526da65c 100644 --- a/packages/app/src/context/global-sync.tsx +++ b/packages/app/src/context/global-sync.tsx @@ -422,7 +422,13 @@ function createGlobalSync() { const updateConfigMutation = useMutation(() => ({ mutationFn: (config: Config) => globalSDK.client.global.config.update({ config }), - onSuccess: () => bootstrap.refetch(), + onSuccess: () => { + bootstrap.refetch() + // Invalidate all provider queries so newly configured custom providers + // appear immediately in the available provider list across all directories. + queryClient.invalidateQueries({ queryKey: [null, "providers"] }) + queryClient.invalidateQueries({ predicate: (query) => query.queryKey[1] === "providers" }) + }, })) return {