From 26e7a1ac35829fd210f65a8e21d5953c8a709103 Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Wed, 8 May 2024 02:13:08 +0100 Subject: [PATCH] Bugfix/Credential mandatory field when preview chunks (#2356) check if credential is mandatory field when preview chunks --- .../src/views/docstore/LoaderConfigPreviewChunks.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/views/docstore/LoaderConfigPreviewChunks.jsx b/packages/ui/src/views/docstore/LoaderConfigPreviewChunks.jsx index 846319f64..de1ec068a 100644 --- a/packages/ui/src/views/docstore/LoaderConfigPreviewChunks.jsx +++ b/packages/ui/src/views/docstore/LoaderConfigPreviewChunks.jsx @@ -120,9 +120,14 @@ const LoaderConfigPreviewChunks = () => { let canSubmit = true const inputParams = (selectedDocumentLoader.inputParams ?? []).filter((inputParam) => !inputParam.hidden) for (const inputParam of inputParams) { - if (!inputParam.optional && !selectedDocumentLoader.inputs[inputParam.name]) { - canSubmit = false - break + if (!inputParam.optional && (!selectedDocumentLoader.inputs[inputParam.name] || !selectedDocumentLoader.credential)) { + if (inputParam.type === 'credential' && !selectedDocumentLoader.credential) { + canSubmit = false + break + } else if (inputParam.type !== 'credential' && !selectedDocumentLoader.inputs[inputParam.name]) { + canSubmit = false + break + } } } if (!canSubmit) {