mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
🔧 fix: MCP Queries and Connections (#8870)
* fix: add refetchQueries on connection success so ToolSelectDialog doesn't require hard refresh * fix: change hook so we only query connection status when mcpServers are configured * fix: change refetchQueries to invalidateQueries for tools after server connection update --------- Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
8530594f37
commit
47caafa8f8
1 changed files with 5 additions and 1 deletions
|
|
@ -81,7 +81,9 @@ export function useMCPServerManager() {
|
||||||
return initialStates;
|
return initialStates;
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: connectionStatusData } = useMCPConnectionStatusQuery();
|
const { data: connectionStatusData } = useMCPConnectionStatusQuery({
|
||||||
|
enabled: !!startupConfig?.mcpServers && Object.keys(startupConfig.mcpServers).length > 0,
|
||||||
|
});
|
||||||
const connectionStatus = useMemo(
|
const connectionStatus = useMemo(
|
||||||
() => connectionStatusData?.connectionStatus || {},
|
() => connectionStatusData?.connectionStatus || {},
|
||||||
[connectionStatusData?.connectionStatus],
|
[connectionStatusData?.connectionStatus],
|
||||||
|
|
@ -158,6 +160,8 @@ export function useMCPServerManager() {
|
||||||
setMCPValues([...currentValues, serverName]);
|
setMCPValues([...currentValues, serverName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await queryClient.invalidateQueries([QueryKeys.tools]);
|
||||||
|
|
||||||
// This delay is to ensure UI has updated with new connection status before cleanup
|
// This delay is to ensure UI has updated with new connection status before cleanup
|
||||||
// Otherwise servers will show as disconnected for a second after OAuth flow completes
|
// Otherwise servers will show as disconnected for a second after OAuth flow completes
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue