Sfoglia il codice sorgente

fix(app): invalidate provider queries after config update to show custom providers immediately (#28313)

Shawn 3 mesi fa
parent
commit
2932a7a35d
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 7 1
      packages/app/src/context/global-sync.tsx

+ 7 - 1
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 {