From 3aa7e57b3d481c4bc52386922476671a1f8875d9 Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Wed, 17 Jul 2024 15:17:37 +0800 Subject: [PATCH] fix(console): fix Google connector `scope` field can not be unset bug (#6254) --- .changeset/cool-otters-unite.md | 5 +++++ .../src/pages/ConnectorDetails/ConnectorContent/index.tsx | 2 +- packages/console/src/utils/connector-form.ts | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 .changeset/cool-otters-unite.md diff --git a/.changeset/cool-otters-unite.md b/.changeset/cool-otters-unite.md new file mode 100644 index 000000000..b82659b6d --- /dev/null +++ b/.changeset/cool-otters-unite.md @@ -0,0 +1,5 @@ +--- +"@logto/console": patch +--- + +fix Google connector `scope` field can not be reset bug diff --git a/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx b/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx index 5d56a1849..48541240f 100644 --- a/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx +++ b/packages/console/src/pages/ConnectorDetails/ConnectorContent/index.tsx @@ -68,7 +68,7 @@ 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 = { ...rawConfig, ...configParser(data, formItems) }; + const config = removeFalsyValues({ ...rawConfig, ...configParser(data, formItems) }); const payload = isSocialConnector ? { diff --git a/packages/console/src/utils/connector-form.ts b/packages/console/src/utils/connector-form.ts index 237b0fa41..762704cef 100644 --- a/packages/console/src/utils/connector-form.ts +++ b/packages/console/src/utils/connector-form.ts @@ -27,11 +27,6 @@ export const parseFormConfig = ( return Object.fromEntries( Object.entries(config) .map(([key, value]) => { - // Filter out empty input - if (value === '') { - return null; - } - const formItem = formItems.find((item) => item.key === key); if (!formItem) {