mirror of https://github.com/kortix-ai/suna.git
Merge pull request #1789 from escapade-mckv/triggers-display
fix: infinite render
This commit is contained in:
commit
f6174e034f
|
@ -50,7 +50,6 @@ import { useAgentVersionData } from '@/hooks/use-agent-version-data';
|
||||||
import { useUpdateAgent, useAgents } from '@/hooks/react-query/agents/use-agents';
|
import { useUpdateAgent, useAgents } from '@/hooks/react-query/agents/use-agents';
|
||||||
import { useUpdateAgentMCPs } from '@/hooks/react-query/agents/use-update-agent-mcps';
|
import { useUpdateAgentMCPs } from '@/hooks/react-query/agents/use-update-agent-mcps';
|
||||||
import { useExportAgent } from '@/hooks/react-query/agents/use-agent-export-import';
|
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 { ExpandableMarkdownEditor } from '@/components/ui/expandable-markdown-editor';
|
||||||
import { AgentModelSelector } from './config/model-selector';
|
import { AgentModelSelector } from './config/model-selector';
|
||||||
import { AgentToolsConfiguration } from './agent-tools-configuration';
|
import { AgentToolsConfiguration } from './agent-tools-configuration';
|
||||||
|
@ -111,29 +110,6 @@ export function AgentConfigurationDialog({
|
||||||
}
|
}
|
||||||
}, [open, initialTab]);
|
}, [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({
|
const [formData, setFormData] = useState({
|
||||||
name: '',
|
name: '',
|
||||||
system_prompt: '',
|
system_prompt: '',
|
||||||
|
|
Loading…
Reference in New Issue