Skip to content

Commit

Permalink
fix: issues/1334 useTransition 导致光标刷新后移问题; (FlowiseAI#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
maquannene authored Apr 30, 2024
1 parent db6fc53 commit 1529c1e
Showing 1 changed file with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,13 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons';
import JSONEditor from '@fastgpt/web/components/common/Textarea/JsonEditor';
import {
formatEditorVariablePickerIcon,
getGuideModule,
splitGuideModule
} from '@fastgpt/global/core/workflow/utils';
import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/workflow/utils';
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
import HttpInput from '@fastgpt/web/components/common/Input/HttpInput';
import dynamic from 'next/dynamic';
import MySelect from '@fastgpt/web/components/common/MySelect';
import RenderToolInput from '../render/RenderToolInput';
import IOTitle from '../../components/IOTitle';
import { getSystemVariables } from '@/web/core/app/utils';
import { useContextSelector } from 'use-context-selector';
import { WorkflowContext } from '../../../context';
import { getWorkflowGlobalVariables } from '@/web/core/workflow/utils';
Expand Down Expand Up @@ -106,7 +101,6 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({
}) {
const { t } = useTranslation();
const { toast } = useToast();
const [_, startSts] = useTransition();
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);

const { isOpen: isOpenCurl, onOpen: onOpenCurl, onClose: onCloseCurl } = useDisclosure();
Expand All @@ -116,20 +110,19 @@ const RenderHttpMethodAndUrl = React.memo(function RenderHttpMethodAndUrl({

const onChangeUrl = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
startSts(() => {
onChangeNode({
nodeId,
type: 'updateInput',
key: NodeInputKeyEnum.httpReqUrl,
value: {
...requestUrl,
value: e.target.value
}
});
onChangeNode({
nodeId,
type: 'updateInput',
key: NodeInputKeyEnum.httpReqUrl,
value: {
...requestUrl,
value: e.target.value
}
});
},
[nodeId, onChangeNode, requestUrl]
);

const onBlurUrl = useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
const val = e.target.value;
Expand Down

0 comments on commit 1529c1e

Please sign in to comment.