mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
fix: issues/1334 useTransition 导致光标刷新后移问题; (#1338)
This commit is contained in:
@@ -28,18 +28,13 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
|
|||||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||||
import JSONEditor from '@fastgpt/web/components/common/Textarea/JsonEditor';
|
import JSONEditor from '@fastgpt/web/components/common/Textarea/JsonEditor';
|
||||||
import {
|
import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/workflow/utils';
|
||||||
formatEditorVariablePickerIcon,
|
|
||||||
getGuideModule,
|
|
||||||
splitGuideModule
|
|
||||||
} from '@fastgpt/global/core/workflow/utils';
|
|
||||||
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
|
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
|
||||||
import HttpInput from '@fastgpt/web/components/common/Input/HttpInput';
|
import HttpInput from '@fastgpt/web/components/common/Input/HttpInput';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
import MySelect from '@fastgpt/web/components/common/MySelect';
|
import MySelect from '@fastgpt/web/components/common/MySelect';
|
||||||
import RenderToolInput from '../render/RenderToolInput';
|
import RenderToolInput from '../render/RenderToolInput';
|
||||||
import IOTitle from '../../components/IOTitle';
|
import IOTitle from '../../components/IOTitle';
|
||||||
import { getSystemVariables } from '@/web/core/app/utils';
|
|
||||||
import { useContextSelector } from 'use-context-selector';
|
import { useContextSelector } from 'use-context-selector';
|
||||||
import { WorkflowContext } from '../../../context';
|
import { WorkflowContext } from '../../../context';
|
||||||
import { getWorkflowGlobalVariables } from '@/web/core/workflow/utils';
|
import { getWorkflowGlobalVariables } from '@/web/core/workflow/utils';
|
||||||
@@ -106,7 +101,6 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({
|
|||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const [_, startSts] = useTransition();
|
|
||||||
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
||||||
|
|
||||||
const { isOpen: isOpenCurl, onOpen: onOpenCurl, onClose: onCloseCurl } = useDisclosure();
|
const { isOpen: isOpenCurl, onOpen: onOpenCurl, onClose: onCloseCurl } = useDisclosure();
|
||||||
@@ -116,20 +110,19 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({
|
|||||||
|
|
||||||
const onChangeUrl = useCallback(
|
const onChangeUrl = useCallback(
|
||||||
(e: React.ChangeEvent<HTMLInputElement>) => {
|
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
startSts(() => {
|
onChangeNode({
|
||||||
onChangeNode({
|
nodeId,
|
||||||
nodeId,
|
type: 'updateInput',
|
||||||
type: 'updateInput',
|
key: NodeInputKeyEnum.httpReqUrl,
|
||||||
key: NodeInputKeyEnum.httpReqUrl,
|
value: {
|
||||||
value: {
|
...requestUrl,
|
||||||
...requestUrl,
|
value: e.target.value
|
||||||
value: e.target.value
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[nodeId, onChangeNode, requestUrl]
|
[nodeId, onChangeNode, requestUrl]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onBlurUrl = useCallback(
|
const onBlurUrl = useCallback(
|
||||||
(e: React.ChangeEvent<HTMLInputElement>) => {
|
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const val = e.target.value;
|
const val = e.target.value;
|
||||||
|
Reference in New Issue
Block a user