mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-03-09 00:10:31 -07:00
fix: callback not useCallback cause autocomplete panel flash
This commit is contained in:
parent
19902d7c51
commit
0d54f12164
1 changed files with 3 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ import type { AgentDefinition } from '@services/agentDefinition/interface';
|
|||
import { AgentFrameworkConfig } from '@services/agentInstance/promptConcat/promptConcatSchema';
|
||||
import useDebouncedCallback from 'beautiful-react-hooks/useDebouncedCallback';
|
||||
import { nanoid } from 'nanoid';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TemplateSearch } from '../../components/Search/TemplateSearch';
|
||||
import { useTabStore } from '../../store/tabStore';
|
||||
|
|
@ -219,7 +219,7 @@ export const CreateNewAgentContent: React.FC<CreateNewAgentContentProps> = ({ ta
|
|||
}
|
||||
};
|
||||
|
||||
const handleTemplateSelect = async (template: AgentDefinition) => {
|
||||
const handleTemplateSelect = useCallback(async (template: AgentDefinition) => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setSelectedTemplate(template);
|
||||
|
|
@ -250,7 +250,7 @@ export const CreateNewAgentContent: React.FC<CreateNewAgentContentProps> = ({ ta
|
|||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
}, [agentName, tab.id, updateTabData]);
|
||||
|
||||
const handleAgentDefinitionChange = async (updatedDefinition: AgentDefinition) => {
|
||||
// Immediately update React state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue