Merge pull request #1789 from escapade-mckv/triggers-display

fix: infinite render
This commit is contained in:
Bobbie 2025-10-08 15:14:03 +05:30 committed by GitHub
commit f6174e034f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 24 deletions

View File

@ -50,7 +50,6 @@ import { useAgentVersionData } from '@/hooks/use-agent-version-data';
import { useUpdateAgent, useAgents } from '@/hooks/react-query/agents/use-agents';
import { useUpdateAgentMCPs } from '@/hooks/react-query/agents/use-update-agent-mcps';
import { useExportAgent } from '@/hooks/react-query/agents/use-agent-export-import';
import { agentKeys } from '@/hooks/react-query/agents/keys';
import { ExpandableMarkdownEditor } from '@/components/ui/expandable-markdown-editor';
import { AgentModelSelector } from './config/model-selector';
import { AgentToolsConfiguration } from './agent-tools-configuration';
@ -111,29 +110,6 @@ export function AgentConfigurationDialog({
}
}, [open, initialTab]);
// Listen for query invalidations and refetch when agent data changes
useEffect(() => {
const unsubscribe = queryClient.getQueryCache().subscribe((event) => {
// Check if the invalidation is for this agent's data
if (event?.type === 'updated' && event?.query?.queryKey) {
const queryKey = event.query.queryKey;
// Check if it's an agent-related query for our agentId
if (
(Array.isArray(queryKey) && queryKey.includes(agentId)) ||
(Array.isArray(queryKey) && queryKey.includes('agents') && queryKey.includes('detail')) ||
(Array.isArray(queryKey) && queryKey.includes('versions'))
) {
// Force a re-render by invalidating our specific queries
queryClient.invalidateQueries({ queryKey: agentKeys.detail(agentId) });
queryClient.invalidateQueries({ queryKey: ['versions', 'list', agentId] });
}
}
});
return () => unsubscribe();
}, [agentId, queryClient]);
const [formData, setFormData] = useState({
name: '',
system_prompt: '',