From ed861ff78266256463a061b79278d2e059b9910d Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 18 Apr 2024 12:08:18 +0800 Subject: [PATCH] fix: json in raw text sometimes changed back to key value in HTTP node (#3586) --- .../workflow/nodes/http/components/edit-body/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx index e90a7c68f4..52690e198c 100644 --- a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx +++ b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx @@ -59,19 +59,22 @@ const EditBody: FC = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [onChange]) + const isCurrentKeyValue = type === BodyType.formData || type === BodyType.xWwwFormUrlencoded + const { list: body, setList: setBody, addItem: addBody, } = useKeyValueList(payload.data, (value) => { + if (!isCurrentKeyValue) + return + const newBody = produce(payload, (draft: Body) => { draft.data = value }) onChange(newBody) }, type === BodyType.json) - const isCurrentKeyValue = type === BodyType.formData || type === BodyType.xWwwFormUrlencoded - useEffect(() => { if (!isCurrentKeyValue) return