diff --git a/packages/console/src/hooks/use-connector-form-config-parser.tsx b/packages/console/src/hooks/use-connector-form-config-parser.tsx index 38ef40dcc..d6e20f501 100644 --- a/packages/console/src/hooks/use-connector-form-config-parser.tsx +++ b/packages/console/src/hooks/use-connector-form-config-parser.tsx @@ -31,9 +31,13 @@ const useJsonStringConfigParser = () => { export const useConnectorFormConfigParser = () => { const parseJsonConfig = useJsonStringConfigParser(); - return (data: ConnectorFormType, formItems: ConnectorResponse['formItems']) => { + return ( + data: ConnectorFormType, + formItems: ConnectorResponse['formItems'], + skipFalsyValuesRemoval = false + ) => { return formItems - ? parseFormConfig(data.formConfig, formItems) + ? parseFormConfig(data.formConfig, formItems, skipFalsyValuesRemoval) : parseJsonConfig(data.jsonConfig); }; }; diff --git a/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx b/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx index 48541240f..da1c0dd9d 100644 --- a/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx +++ b/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx @@ -68,7 +68,11 @@ function ConnectorContent({ isDeleted, connectorData, onConnectorUpdated }: Prop const { syncProfile, name, logo, logoDark, target, rawConfig } = data; // Apply the raw config first to avoid losing data updated from other forms that are not // included in the form items. - const config = removeFalsyValues({ ...rawConfig, ...configParser(data, formItems) }); + // Explicitly SKIP falsy values removal logic (the last argument of `configParser()` method) for social connectors. + const config = removeFalsyValues({ + ...rawConfig, + ...configParser(data, formItems, isSocialConnector), + }); const payload = isSocialConnector ? { diff --git a/packages/console/src/utils/connector-form.ts b/packages/console/src/utils/connector-form.ts index 762704cef..f0a7f423c 100644 --- a/packages/console/src/utils/connector-form.ts +++ b/packages/console/src/utils/connector-form.ts @@ -22,11 +22,17 @@ const initFormData = (formItems: ConnectorConfigFormItem[], config?: Record, - formItems: ConnectorConfigFormItem[] + formItems: ConnectorConfigFormItem[], + skipFalsyValuesRemoval = false ) => { return Object.fromEntries( Object.entries(config) .map(([key, value]) => { + // Filter out empty input + if (!skipFalsyValuesRemoval && value === '') { + return null; + } + const formItem = formItems.find((item) => item.key === key); if (!formItem) {